mac: set the --exec-path when calling the bundled git

This commit is contained in:
Hylke Bons 2012-01-22 17:17:36 +00:00
parent 07527618af
commit 43f2129236
2 changed files with 18 additions and 5 deletions

View file

@ -16,26 +16,34 @@
using System; using System;
using System.IO;
using System.Diagnostics; using System.Diagnostics;
namespace SparkleLib { namespace SparkleLib {
public class SparkleGit : Process { public class SparkleGit : Process {
public static string ExecPath = null;
public SparkleGit (string path, string args) : base () public SparkleGit (string path, string args) : base ()
{ {
EnableRaisingEvents = true; EnableRaisingEvents = true;
StartInfo.FileName = SparkleBackend.DefaultBackend.Path; StartInfo.FileName = SparkleBackend.DefaultBackend.Path;
StartInfo.Arguments = args;
StartInfo.RedirectStandardOutput = true; StartInfo.RedirectStandardOutput = true;
StartInfo.UseShellExecute = false; StartInfo.UseShellExecute = false;
StartInfo.WorkingDirectory = path; StartInfo.WorkingDirectory = path;
if (!string.IsNullOrEmpty (ExecPath))
StartInfo.Arguments = "--exec-path=\"" + ExecPath + "\" " + args;
else
StartInfo.Arguments = args;
} }
new public void Start () new public void Start ()
{ {
SparkleHelpers.DebugInfo ("Cmd", StartInfo.FileName + " " + StartInfo.Arguments); SparkleHelpers.DebugInfo ("Cmd", "git " + StartInfo.Arguments);
base.Start (); base.Start ();
} }
} }

View file

@ -42,20 +42,25 @@ namespace SparkleShare {
public SparkleController () : base () public SparkleController () : base ()
{ {
string content_path = string content_path =
Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory) Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory).ToString ();
.ToString ();
string app_path = Directory.GetParent (content_path).ToString (); string app_path = Directory.GetParent (content_path).ToString ();
string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl"); string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl");
// Needed for Growl // Needed for Growl
Dlfcn.dlopen (growl_path, 0); Dlfcn.dlopen (growl_path, 0);
NSApplication.Init (); NSApplication.Init ();
// Let's use the bundled git first // Let's use the bundled git first
SparkleBackend.DefaultBackend.Path = SparkleBackend.DefaultBackend.Path =
Path.Combine (NSBundle.MainBundle.ResourcePath, Path.Combine (NSBundle.MainBundle.ResourcePath,
"git", "bin", "git"); "git", "libexec", "git-core", "git");
SparkleGit.ExecPath =
Path.Combine (NSBundle.MainBundle.ResourcePath,
"git", "libexec", "git-core");
} }