provide example for running the whole software company; fix editor bug

This commit is contained in:
garylin2099 2024-06-06 10:41:49 +08:00
parent a59b9e2286
commit 8e2c7c964f
3 changed files with 56 additions and 10 deletions

View file

@ -27,7 +27,7 @@ class Editor:
def write(self, path: str, content: str):
"""Write the whole content to a file. When used, make sure content arg contains the full content of the file."""
directory = os.path.dirname(path)
if not os.path.exists(directory):
if directory and not os.path.exists(directory):
os.makedirs(directory)
with open(path, "w", encoding="utf-8") as f:
f.write(content)