Commit cacd14be authored by cryzed's avatar cryzed Committed by AUTOMATIC1111

Only create backup if path exists

parent 5fbed652
......@@ -63,5 +63,6 @@ def save_styles(path: str, styles: abc.Iterable[PromptStyle]) -> None:
writer.writerows(style._asdict() for style in styles)
# Always keep a backup file around
shutil.copy(path, path + ".bak")
if os.path.exists(path):
shutil.move(path, path + ".bak")
shutil.move(temp_path, path)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment