Browse Source

Switch some settings paths to use Compat

pull/55/head
Ionite 1 year ago
parent
commit
efd4e2f13f
No known key found for this signature in database
  1. 8
      StabilityMatrix.Core/Services/SettingsManager.cs

8
StabilityMatrix.Core/Services/SettingsManager.cs

@ -213,14 +213,12 @@ public class SettingsManager : ISettingsManager
/// </summary> /// </summary>
public void SetLibraryPath(string path) public void SetLibraryPath(string path)
{ {
var appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); Compat.AppDataHome.Create();
var homeDir = Path.Combine(appDataDir, "StabilityMatrix"); var libraryJsonFile = Compat.AppDataHome.JoinFile("library.json");
Directory.CreateDirectory(homeDir);
var libraryJsonPath = Path.Combine(homeDir, "library.json");
var library = new LibrarySettings { LibraryPath = path }; var library = new LibrarySettings { LibraryPath = path };
var libraryJson = JsonSerializer.Serialize(library, new JsonSerializerOptions { WriteIndented = true }); var libraryJson = JsonSerializer.Serialize(library, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(libraryJsonPath, libraryJson); libraryJsonFile.WriteAllText(libraryJson);
// actually create the LibraryPath directory // actually create the LibraryPath directory
Directory.CreateDirectory(path); Directory.CreateDirectory(path);

Loading…
Cancel
Save