aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcryzed <cryzed@googlemail.com>2022-09-11 18:17:09 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2022-09-11 18:23:49 +0000
commitcacd14bee89d1c1ff00fb11ebd2c68b407c90f1f (patch)
treec5c3cd3c66693764de911992ef59509e39b861b0
parent5fbed65236d539b657eaf3b88138388cd8b66544 (diff)
downloadstable-diffusion-webui-gfx803-cacd14bee89d1c1ff00fb11ebd2c68b407c90f1f.tar.gz
stable-diffusion-webui-gfx803-cacd14bee89d1c1ff00fb11ebd2c68b407c90f1f.tar.bz2
stable-diffusion-webui-gfx803-cacd14bee89d1c1ff00fb11ebd2c68b407c90f1f.zip
Only create backup if path exists
-rw-r--r--modules/styles.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/styles.py b/modules/styles.py
index 25ec504b..bc7f070f 100644
--- a/modules/styles.py
+++ b/modules/styles.py
@@ -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)