chore(uv): prepend ~/.local/bin and common bins to PATH for 'which uv' in GUI env

main
David Sarno 2025-08-12 10:48:46 -07:00
parent 6b3a20dd78
commit f6f8b24371
1 changed files with 16 additions and 0 deletions

View File

@ -328,6 +328,22 @@ namespace UnityMcpBridge.Editor.Helpers
RedirectStandardError = true,
CreateNoWindow = true
};
try
{
// Prepend common user-local and package manager locations so 'which' can see them in Unity's GUI env
string homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) ?? string.Empty;
string prepend = string.Join(":", new[]
{
System.IO.Path.Combine(homeDir, ".local", "bin"),
"/opt/homebrew/bin",
"/usr/local/bin",
"/usr/bin",
"/bin"
});
string currentPath = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
whichPsi.Environment["PATH"] = string.IsNullOrEmpty(currentPath) ? prepend : (prepend + ":" + currentPath);
}
catch { }
using var wp = System.Diagnostics.Process.Start(whichPsi);
string output = wp.StandardOutput.ReadToEnd().Trim();
wp.WaitForExit(3000);