|
|
@ -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); |
|
|
|