[paths] look for git using whereis
This commit is contained in:
parent
7be6da70c4
commit
43290d387e
|
@ -24,7 +24,7 @@ namespace SparkleLib {
|
||||||
public static class SparklePaths
|
public static class SparklePaths
|
||||||
{
|
{
|
||||||
|
|
||||||
public static string GitPath = "/usr/bin/git"; // TODO: Don't hardcode this
|
public static string GitPath = SystemGitPath;
|
||||||
|
|
||||||
public static string HomePath = new UnixUserInfo (UnixEnvironment.UserName).HomeDirectory;
|
public static string HomePath = new UnixUserInfo (UnixEnvironment.UserName).HomeDirectory;
|
||||||
|
|
||||||
|
@ -44,9 +44,11 @@ namespace SparkleLib {
|
||||||
"icons");
|
"icons");
|
||||||
|
|
||||||
|
|
||||||
private static string GetGitPath ()
|
private static string SystemGitPath
|
||||||
{
|
{
|
||||||
|
|
||||||
|
get {
|
||||||
|
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
|
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
|
@ -55,15 +57,26 @@ namespace SparkleLib {
|
||||||
process.StartInfo.Arguments = "git";
|
process.StartInfo.Arguments = "git";
|
||||||
process.Start ();
|
process.Start ();
|
||||||
|
|
||||||
string git_path = process.StandardOutput.ReadToEnd ().Trim ();
|
string git_path = process.StandardOutput.ReadToEnd ();
|
||||||
|
git_path = git_path.Trim ();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty (git_path)) {
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty (git_path))
|
|
||||||
return git_path;
|
return git_path;
|
||||||
else
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Console.WriteLine ("Sorry, SparkleShare needs Git to run, but it wasn't found.");
|
||||||
|
Environment.Exit (-1);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue