提交 cacd14be 编写于 作者: C cryzed 提交者: AUTOMATIC1111

Only create backup if path exists

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册