From 3e59f92cadbb59678bbd0d90e0077b6e104bd17e Mon Sep 17 00:00:00 2001 From: JT Date: Fri, 16 Aug 2024 18:31:08 -0700 Subject: [PATCH] Fix swarm settings being overwritten on launch --- CHANGELOG.md | 1 + .../Models/Packages/StableSwarm.cs | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55342dc0..ce673496 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2 ## v2.11.8 ### Fixed - Fixed CivitAI model browser not loading search results +- Fixed SwarmUI settings being overwritten on launch ## v2.11.7 ### Changed diff --git a/StabilityMatrix.Core/Models/Packages/StableSwarm.cs b/StabilityMatrix.Core/Models/Packages/StableSwarm.cs index df6183ee..e644530b 100644 --- a/StabilityMatrix.Core/Models/Packages/StableSwarm.cs +++ b/StabilityMatrix.Core/Models/Packages/StableSwarm.cs @@ -376,7 +376,35 @@ private Task SetupModelFoldersConfig(DirectoryPath installDirectory) if (settingsExists) { var section = FDSUtility.ReadFile(settingsPath); - existingSettings.Load(section); + var paths = section.GetSection("Paths"); + paths.Set("ModelRoot", settingsManager.ModelsDirectory); + paths.Set( + "SDModelFolder", + Path.Combine(settingsManager.ModelsDirectory, SharedFolderType.StableDiffusion.ToString()) + ); + paths.Set( + "SDLoraFolder", + Path.Combine(settingsManager.ModelsDirectory, SharedFolderType.Lora.ToString()) + ); + paths.Set( + "SDVAEFolder", + Path.Combine(settingsManager.ModelsDirectory, SharedFolderType.VAE.ToString()) + ); + paths.Set( + "SDEmbeddingFolder", + Path.Combine(settingsManager.ModelsDirectory, SharedFolderType.TextualInversion.ToString()) + ); + paths.Set( + "SDControlNetsFolder", + Path.Combine(settingsManager.ModelsDirectory, SharedFolderType.ControlNet.ToString()) + ); + paths.Set( + "SDClipVisionFolder", + Path.Combine(settingsManager.ModelsDirectory, SharedFolderType.InvokeClipVision.ToString()) + ); + section.Set("Paths", paths); + section.SaveToFile(settingsPath); + return Task.CompletedTask; } existingSettings.Paths = new StableSwarmSettings.PathsData