strip() the before_text when looking for empty ORIGINAL

This commit is contained in:
Paul Gauthier 2023-05-09 07:10:40 -07:00
parent cbfdd2a806
commit 4b56381382

View file

@ -389,13 +389,13 @@ class Coder:
fname = Path(fname) fname = Path(fname)
# does it want to make a new file? # does it want to make a new file?
if not fname.exists() and not before_text: if not fname.exists() and not before_text.strip():
print("Creating empty file:", fname) print("Creating empty file:", fname)
fname.touch() fname.touch()
content = fname.read_text() content = fname.read_text()
if not before_text: if not before_text.strip():
if content: if content:
new_content = content + after_text new_content = content + after_text
else: else: