Skip to content

Commit f6f8b24

Browse files
committed
chore(uv): prepend ~/.local/bin and common bins to PATH for 'which uv' in GUI env
1 parent 6b3a20d commit f6f8b24

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

UnityMcpBridge/Editor/Helpers/ServerInstaller.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,22 @@ internal static string FindUvPath()
328328
RedirectStandardError = true,
329329
CreateNoWindow = true
330330
};
331+
try
332+
{
333+
// Prepend common user-local and package manager locations so 'which' can see them in Unity's GUI env
334+
string homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) ?? string.Empty;
335+
string prepend = string.Join(":", new[]
336+
{
337+
System.IO.Path.Combine(homeDir, ".local", "bin"),
338+
"/opt/homebrew/bin",
339+
"/usr/local/bin",
340+
"/usr/bin",
341+
"/bin"
342+
});
343+
string currentPath = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
344+
whichPsi.Environment["PATH"] = string.IsNullOrEmpty(currentPath) ? prepend : (prepend + ":" + currentPath);
345+
}
346+
catch { }
331347
using var wp = System.Diagnostics.Process.Start(whichPsi);
332348
string output = wp.StandardOutput.ReadToEnd().Trim();
333349
wp.WaitForExit(3000);

0 commit comments

Comments
 (0)