From 16d3ae0bf99750cb6ff25daa12aa5bf73a29f12f Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 6 May 2023 10:57:32 -0700 Subject: [PATCH] create empty file --- coder.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coder.py b/coder.py index 4a44f893f..c13ea1a2e 100755 --- a/coder.py +++ b/coder.py @@ -317,6 +317,12 @@ class Coder: after_text = self.strip_quoted_wrapping(after_text, fname) fname = Path(fname) + + # does it want to make a new file? + if not fname.exists() and not before_text: + print('Creating empty file:', fname) + fname.touch() + content = fname.read_text().splitlines() if not before_text and not content: