Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions invokeai/app/services/model_install/model_install_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,16 +623,13 @@ def _move_model(self, old_path: Path, new_path: Path) -> Path:
if old_path == new_path:
return old_path

if new_path.exists():
raise FileExistsError(f"Cannot move {old_path} to {new_path}: destination already exists")

new_path.parent.mkdir(parents=True, exist_ok=True)

# if path already exists then we jigger the name to make it unique
counter: int = 1
while new_path.exists():
path = new_path.with_stem(new_path.stem + f"_{counter:02d}")
if not path.exists():
new_path = path
counter += 1
move(old_path, new_path)

return new_path

def _probe(self, model_path: Path, config: Optional[ModelRecordChanges] = None):
Expand Down