From 3951549e5cb67141716035d1a31fae437d4bea35 Mon Sep 17 00:00:00 2001 From: aikawayataro Date: Tue, 8 Oct 2024 08:07:50 +0000 Subject: [PATCH] enhance: append to PATH on MacOS instead of overriding it (#546) --- src/Commands/Command.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Commands/Command.cs b/src/Commands/Command.cs index 55fc6d17..72c10b0c 100644 --- a/src/Commands/Command.cs +++ b/src/Commands/Command.cs @@ -199,7 +199,17 @@ namespace SourceGit.Commands // Fix sometimes `LSEnvironment` not working on macOS 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. switch (Editor)