mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
fix: application data dir may not have been created before crash (#161)
This commit is contained in:
parent
f1f54bf6fe
commit
49ce07443e
4 changed files with 8 additions and 12 deletions
|
@ -459,10 +459,6 @@ namespace SourceGit.ViewModels
|
|||
|
||||
public static void Save()
|
||||
{
|
||||
var dir = Path.GetDirectoryName(_savePath);
|
||||
if (!Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
var data = JsonSerializer.Serialize(_instance, JsonCodeGen.Default.Preference);
|
||||
File.WriteAllText(_savePath, data);
|
||||
}
|
||||
|
@ -515,10 +511,7 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
|
||||
private static Preference _instance = null;
|
||||
private static readonly string _savePath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"SourceGit",
|
||||
"preference.json");
|
||||
private static readonly string _savePath = Path.Combine(Native.OS.DataDir, "preference.json");
|
||||
|
||||
private string _locale = "en_US";
|
||||
private string _theme = "Default";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue