fix: application data dir may not have been created before crash (#161)

This commit is contained in:
leo 2024-06-03 09:44:12 +08:00
parent f1f54bf6fe
commit 49ce07443e
4 changed files with 8 additions and 12 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Avalonia;
@ -20,6 +21,7 @@ namespace SourceGit.Native
void OpenWithDefaultEditor(string file);
}
public static readonly string DataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SourceGit");
public static string GitExecutable { get; set; } = string.Empty;
public static List<Models.ExternalTool> ExternalTools { get; set; } = new List<Models.ExternalTool>();
@ -72,6 +74,9 @@ namespace SourceGit.Native
public static void SetupApp(AppBuilder builder)
{
if (!Directory.Exists(DataDir))
Directory.CreateDirectory(DataDir);
_backend.SetupApp(builder);
}