enhance: append to PATH on MacOS instead of overriding it (#546)

This commit is contained in:
aikawayataro 2024-10-08 08:07:50 +00:00 committed by GitHub
parent 9a2ea71f41
commit 3951549e5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -199,7 +199,17 @@ namespace SourceGit.Commands
// Fix sometimes `LSEnvironment` not working on macOS // Fix sometimes `LSEnvironment` not working on macOS
if (OperatingSystem.IsMacOS()) if (OperatingSystem.IsMacOS())
start.Environment.Add("PATH", "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"); {
if (start.Environment.TryGetValue("PATH", out var path))
{
path = "/opt/homebrew/bin:/opt/homebrew/sbin:" + path;
}
else
{
path = "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
}
start.Environment.Add("PATH", path);
}
// Force using this app as git editor. // Force using this app as git editor.
switch (Editor) switch (Editor)