Fix the Prompt Saver unable to correctly handle filenames containing . #80

This commit is contained in:
Rhys Yang
2024-06-28 15:20:16 +08:00
parent 4b35b41d08
commit b248fcf346
+3 -3
View File
@@ -669,13 +669,13 @@ class SDPromptSaver:
@staticmethod
def get_unique_filename(stem: Path, extension: str, output_folder: Path):
file = stem.with_suffix(f".{extension}")
file = stem.with_suffix(f"{stem.suffix}.{extension}")
index = 0
while (output_folder / file).exists():
index += 1
new_stem = f"{stem}_{index}"
file = Path(new_stem).with_suffix(f".{extension}")
new_stem = Path(f"{stem}_{index}")
file = new_stem.with_suffix(f"{new_stem.suffix}.{extension}")
return file