mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-05-02 12:56:31 +03:00
change settings.json path to the standard one
This commit is contained in:
@@ -1,17 +1,22 @@
|
|||||||
using System.IO;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace KeyKeeper;
|
namespace KeyKeeper;
|
||||||
|
|
||||||
public static class AppSettings
|
public static class AppSettings
|
||||||
{
|
{
|
||||||
private static readonly string FilePath = "settings.json";
|
private static readonly string FilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "KeyKeeper", "settings.json");
|
||||||
|
|
||||||
public static bool ExitOnRepositoryClose { get; set; } = false;
|
public static bool ExitOnRepositoryClose { get; set; } = false;
|
||||||
|
|
||||||
// Сохранение в файл
|
// Сохранение в файл
|
||||||
public static void Save()
|
public static void Save()
|
||||||
{
|
{
|
||||||
|
var directory = Path.GetDirectoryName(FilePath);
|
||||||
|
if (!string.IsNullOrEmpty(directory))
|
||||||
|
Directory.CreateDirectory(directory);
|
||||||
|
|
||||||
var data = new { ExitOnRepositoryClose };
|
var data = new { ExitOnRepositoryClose };
|
||||||
string json = JsonSerializer.Serialize(data);
|
string json = JsonSerializer.Serialize(data);
|
||||||
File.WriteAllText(FilePath, json);
|
File.WriteAllText(FilePath, json);
|
||||||
@@ -39,4 +44,4 @@ public static class AppSettings
|
|||||||
{
|
{
|
||||||
public bool ExitOnRepositoryClose { get; set; }
|
public bool ExitOnRepositoryClose { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user