mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
feature: add -p:EnablePortable=true
option for dotnet publish
command to store app data portable (#834)
This commit is contained in:
parent
7028e08390
commit
f53b71bfe7
3 changed files with 21 additions and 3 deletions
|
@ -1,5 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if ENABLE_PORTABLE
|
||||
using System.Diagnostics;
|
||||
#endif
|
||||
using System.IO;
|
||||
|
||||
using Avalonia;
|
||||
|
@ -55,6 +58,16 @@ namespace SourceGit.Native
|
|||
|
||||
public static void SetupDataDir()
|
||||
{
|
||||
#if ENABLE_PORTABLE
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
var execFile = Process.GetCurrentProcess().MainModule!.FileName;
|
||||
DataDir = Path.Combine(Path.GetDirectoryName(execFile), "data");
|
||||
if (!Directory.Exists(DataDir))
|
||||
Directory.CreateDirectory(DataDir);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
var osAppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
if (string.IsNullOrEmpty(osAppDataDir))
|
||||
DataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".sourcegit");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue