Skip to content

Commit 207e6c6

Browse files
authored
Merge pull request LykosAI#983 from ionite34/backport/main/pr-982
[dev to main] backport: fix install location path combining (982)
2 parents 3580b25 + 1c841b8 commit 207e6c6

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
1111
### Fixed
1212
- Fixed [#1128](https://github.com/LykosAI/StabilityMatrix/issues/1128) - overwriting models when downloading multiple with the same name
1313
- Fixed ROCm torch indexes for ComfyUI & Forge
14+
- Fixed model browser sometimes downloading to `ModelsLora` or `ModelsStableDiffusion` folders instead of the correct folder
1415

1516
## v2.13.3
1617
### Changed

StabilityMatrix.Avalonia/ViewModels/Dialogs/SelectModelVersionViewModel.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,19 @@ private void LoadInstallLocations()
317317

318318
if (!downloadDirectory.ToString().EndsWith("Unknown"))
319319
{
320-
installLocations.Add(downloadDirectory.ToString().Replace(rootModelsDirectory, "Models"));
320+
installLocations.Add(
321+
Path.Combine("Models", Path.GetRelativePath(rootModelsDirectory, downloadDirectory))
322+
);
321323
foreach (
322324
var directory in downloadDirectory.EnumerateDirectories(
323325
"*",
324326
EnumerationOptionConstants.AllDirectories
325327
)
326328
)
327329
{
328-
installLocations.Add(directory.ToString().Replace(rootModelsDirectory, "Models"));
330+
installLocations.Add(
331+
Path.Combine("Models", Path.GetRelativePath(rootModelsDirectory, directory))
332+
);
329333
}
330334
}
331335

@@ -335,7 +339,9 @@ var directory in downloadDirectory.EnumerateDirectories(
335339
var stableDiffusionDirectory = rootModelsDirectory.JoinDir(
336340
SharedFolderType.StableDiffusion.GetStringValue()
337341
);
338-
installLocations.Add(stableDiffusionDirectory.ToString().Replace(rootModelsDirectory, "Models"));
342+
installLocations.Add(
343+
Path.Combine("Models", Path.GetRelativePath(rootModelsDirectory, stableDiffusionDirectory))
344+
);
339345
}
340346

341347
installLocations.Add("Custom...");

StabilityMatrix.Core/Models/Packages/FluxGym.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ public override async Task InstallPackage(
8989
// check if sd-scripts is already installed - if so: pull, else: clone
9090
if (Directory.Exists(Path.Combine(installLocation, "sd-scripts")))
9191
{
92-
await prerequisiteHelper
92+
await PrerequisiteHelper
9393
.RunGit(["pull"], onConsoleOutput, Path.Combine(installLocation, "sd-scripts"))
9494
.ConfigureAwait(false);
9595
}
9696
else
9797
{
98-
await prerequisiteHelper
98+
await PrerequisiteHelper
9999
.RunGit(
100100
["clone", "-b", "sd3", "https://github.com/kohya-ss/sd-scripts"],
101101
onConsoleOutput,

0 commit comments

Comments
 (0)