[paths] change the way git lookup is done
This commit is contained in:
parent
6bf6de5cc2
commit
b2253a06ff
|
@ -29,32 +29,15 @@ namespace SparkleLib {
|
||||||
|
|
||||||
get {
|
get {
|
||||||
|
|
||||||
// QUICK RC1 HACK FIX
|
string [] possible_git_paths = {"/usr/bin/git",
|
||||||
if (File.Exists ("/usr/local/git/bin/git"))
|
"/usr/local/git/bin/git",
|
||||||
return "/usr/local/git/bin/git";
|
"/usr/local/bin/git"};
|
||||||
else if (File.Exists ("/usr/bin/git"))
|
|
||||||
return "/usr/bin/git";
|
|
||||||
|
|
||||||
Process process = new Process ();
|
foreach (string git_path in possible_git_paths)
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
if (File.Exists (git_path))
|
||||||
process.StartInfo.UseShellExecute = false;
|
return git_path;
|
||||||
process.StartInfo.FileName = "which";
|
|
||||||
process.StartInfo.Arguments = Backend.Name.ToLower ();
|
|
||||||
process.Start ();
|
|
||||||
|
|
||||||
string path = process.StandardOutput.ReadToEnd ();
|
return null;
|
||||||
path = path.Trim ();
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty (path)) {
|
|
||||||
|
|
||||||
return path;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
Console.WriteLine ("Sorry, SparkleShare needs " + Backend.Name + " to run, but it wasn't found.");
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,17 +48,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
get {
|
get {
|
||||||
|
|
||||||
Process process = new Process ();
|
return (Path != null);
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
|
||||||
process.StartInfo.UseShellExecute = false;
|
|
||||||
process.StartInfo.FileName = "which";
|
|
||||||
process.StartInfo.Arguments = Backend.Name.ToLower ();
|
|
||||||
process.Start ();
|
|
||||||
|
|
||||||
string path = process.StandardOutput.ReadToEnd ();
|
|
||||||
path = path.Trim ();
|
|
||||||
|
|
||||||
return !string.IsNullOrEmpty (path);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue