create empty file

This commit is contained in:
Paul Gauthier 2023-05-06 10:57:32 -07:00
parent cfd415c8f2
commit 16d3ae0bf9

View file

@ -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: