From efd4e2f13f7c5bc0d70b94332c07b51923f38c22 Mon Sep 17 00:00:00 2001 From: Ionite Date: Mon, 31 Jul 2023 15:00:23 -0400 Subject: [PATCH] Switch some settings paths to use Compat --- StabilityMatrix.Core/Services/SettingsManager.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/StabilityMatrix.Core/Services/SettingsManager.cs b/StabilityMatrix.Core/Services/SettingsManager.cs index 9be66c4a..46328446 100644 --- a/StabilityMatrix.Core/Services/SettingsManager.cs +++ b/StabilityMatrix.Core/Services/SettingsManager.cs @@ -213,14 +213,12 @@ public class SettingsManager : ISettingsManager /// public void SetLibraryPath(string path) { - var appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); - var homeDir = Path.Combine(appDataDir, "StabilityMatrix"); - Directory.CreateDirectory(homeDir); - var libraryJsonPath = Path.Combine(homeDir, "library.json"); + Compat.AppDataHome.Create(); + var libraryJsonFile = Compat.AppDataHome.JoinFile("library.json"); var library = new LibrarySettings { LibraryPath = path }; var libraryJson = JsonSerializer.Serialize(library, new JsonSerializerOptions { WriteIndented = true }); - File.WriteAllText(libraryJsonPath, libraryJson); + libraryJsonFile.WriteAllText(libraryJson); // actually create the LibraryPath directory Directory.CreateDirectory(path);