Skip to content
Snippets Groups Projects
Commit 3bf1eaf9 authored by Andreia Gaita's avatar Andreia Gaita
Browse files

Fix the command line environment on mac

parent 8310c7eb
No related branches found
No related tags found
No related merge requests found
......@@ -74,8 +74,13 @@ namespace GitHub.Unity
}
else if (environment.IsMac)
{
// we need to create a temp bash script to set up the environment properly, because
// osx terminal app doesn't inherit the PATH env var and there's no way to pass it in
var envVarFile = environment.FileSystem.GetRandomFileName();
environment.FileSystem.WriteAllLines(envVarFile, new string[] { "cd $GHU_WORKINGDIR", "PATH=$GHU_FULLPATH:$PATH /bin/bash" });
Mono.Unix.Native.Syscall.chmod(envVarFile, (Mono.Unix.Native.FilePermissions)493); // -rwxr-xr-x mode (0755)
startInfo.FileName = "open";
startInfo.Arguments = $"-a Terminal {workingDirectory}";
startInfo.Arguments = $"-a Terminal {envVarFile}";
}
else
{
......
......@@ -54,6 +54,7 @@ namespace GitHub.Unity
var gitPathRoot = Environment.GitInstallPath;
var gitLfsPath = Environment.GitInstallPath;
var gitExecutableDir = Environment.GitExecutablePath.Parent; // original path to git (might be different from install path if it's a symlink)
// Paths to developer tools such as msbuild.exe
//var developerPaths = StringExtensions.JoinForAppending(";", developerEnvironment.GetPaths());
......@@ -78,19 +79,17 @@ namespace GitHub.Unity
if (Environment.IsWindows)
{
var userPath = @"C:\windows\system32;C:\windows";
path = String.Format(CultureInfo.InvariantCulture, @"{0}\cmd;{0}\usr\bin;{1};{2};{0}\usr\share\git-tfs;{3};{4}{5}",
gitPathRoot, execPath, binPath,
gitLfsPath, userPath, developerPaths);
path = $"{gitPathRoot}\\cmd;{gitPathRoot}\\usr\\bin;{execPath};{binPath};{gitLfsPath};{userPath}{developerPaths}";
}
else
{
var userPath = Environment.Path;
path = String.Format(CultureInfo.InvariantCulture, @"{0}:{1}:{2}:{3}{4}",
binPath, execPath, gitLfsPath, userPath, developerPaths);
path = $"{gitExecutableDir}:{binPath}:{execPath}:{gitLfsPath}:{Environment.Path}:{developerPaths}";
}
psi.EnvironmentVariables["GIT_EXEC_PATH"] = execPath.ToString();
psi.EnvironmentVariables["PATH"] = path;
psi.EnvironmentVariables["GHU_FULLPATH"] = path;
psi.EnvironmentVariables["GHU_WORKINGDIR"] = workingDirectory;
psi.EnvironmentVariables["PLINK_PROTOCOL"] = "ssh";
psi.EnvironmentVariables["TERM"] = "msys";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment