mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 21:24:59 +00:00
refactor: fix maxOS PATH
env
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
c8bee2f6ba
commit
c3e1fb93b6
4 changed files with 14 additions and 19 deletions
|
@ -18,9 +18,22 @@ namespace SourceGit.Native
|
|||
DisableDefaultApplicationMenuItems = true,
|
||||
});
|
||||
|
||||
// Fix `PATH` env on macOS.
|
||||
var path = Environment.GetEnvironmentVariable("PATH");
|
||||
if (string.IsNullOrEmpty(path))
|
||||
path = "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
|
||||
else if (!path.Contains("/opt/homebrew/", StringComparison.Ordinal))
|
||||
path = "/opt/homebrew/bin:/opt/homebrew/sbin:" + path;
|
||||
|
||||
var customPathFile = Path.Combine(OS.DataDir, "PATH");
|
||||
if (File.Exists(customPathFile))
|
||||
OS.CustomPathEnv = File.ReadAllText(customPathFile).Trim();
|
||||
{
|
||||
var env = File.ReadAllText(customPathFile).Trim();
|
||||
if (!string.IsNullOrEmpty(env))
|
||||
path = env;
|
||||
}
|
||||
|
||||
Environment.SetEnvironmentVariable("PATH", path);
|
||||
}
|
||||
|
||||
public string FindGitExecutable()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue