mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-02-12 00:22:55 +08:00
Only create backup if path exists
This commit is contained in:
parent
5fbed65236
commit
cacd14bee8
@ -63,5 +63,6 @@ def save_styles(path: str, styles: abc.Iterable[PromptStyle]) -> None:
|
|||||||
writer.writerows(style._asdict() for style in styles)
|
writer.writerows(style._asdict() for style in styles)
|
||||||
|
|
||||||
# Always keep a backup file around
|
# 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)
|
shutil.move(temp_path, path)
|
||||||
|
Loading…
Reference in New Issue
Block a user