mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 13:51:53 +08:00
enhance: make sure the $XDG_DATA_HOME dir exists
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -44,10 +44,14 @@ namespace SourceGit.Native
|
||||
return portableDir;
|
||||
}
|
||||
|
||||
// Gets the `$XDG_DATA_HOME` dir.
|
||||
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
var dataDir = Path.Combine(home, ".local", "share", "SourceGit"); // New data dir: $XDG_DATA_HOME/SourceGit
|
||||
var dataHome = Path.Combine(home, ".local", "share");
|
||||
if (!Directory.Exists(dataHome))
|
||||
Directory.CreateDirectory(dataHome);
|
||||
|
||||
// Migrate old data.
|
||||
// Gets the data dir and migrate old data.
|
||||
var dataDir = Path.Combine(dataHome, "SourceGit");
|
||||
if (!Directory.Exists(dataDir))
|
||||
{
|
||||
var oldDataDir = Path.Combine(home, ".config", "SourceGit"); // Old data dir: $XDG_CONFIG_HOME/SourceGit
|
||||
|
||||
Reference in New Issue
Block a user