protected internal override FilePath DiscoverGitPrefix()
{
string path = SystemReader.GetInstance().Getenv("PATH");
FilePath gitExe = SearchPath(path, "git");
if (gitExe != null)
{
return gitExe.GetParentFile().GetParentFile();
}
if (SystemReader.GetInstance().IsMacOS())
{
// On MacOSX, PATH is shorter when Eclipse is launched from the
// Finder than from a terminal. Therefore try to launch bash as a
// login shell and search using that.
//
string w = ReadPipe(UserHome(), new string[] { "bash", "--login", "-c", "which git"
}, Encoding.Default.Name());
//
//
if (w == null || w.Length == 0)
{
return null;
}
FilePath parentFile = new FilePath(w).GetParentFile();
if (parentFile == null)
{
return null;
}
return parentFile.GetParentFile();
}
return null;
}