From 43f21292360b3af7b245229d6bea6a7942644fc3 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 22 Jan 2012 17:17:36 +0000 Subject: [PATCH] mac: set the --exec-path when calling the bundled git --- SparkleLib/Git/SparkleGit.cs | 12 ++++++++++-- SparkleShare/Mac/SparkleController.cs | 11 ++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/SparkleLib/Git/SparkleGit.cs b/SparkleLib/Git/SparkleGit.cs index 308d73f2..16741d7a 100644 --- a/SparkleLib/Git/SparkleGit.cs +++ b/SparkleLib/Git/SparkleGit.cs @@ -16,26 +16,34 @@ using System; +using System.IO; using System.Diagnostics; namespace SparkleLib { public class SparkleGit : Process { + public static string ExecPath = null; + + public SparkleGit (string path, string args) : base () { EnableRaisingEvents = true; StartInfo.FileName = SparkleBackend.DefaultBackend.Path; - StartInfo.Arguments = args; StartInfo.RedirectStandardOutput = true; StartInfo.UseShellExecute = false; StartInfo.WorkingDirectory = path; + + if (!string.IsNullOrEmpty (ExecPath)) + StartInfo.Arguments = "--exec-path=\"" + ExecPath + "\" " + args; + else + StartInfo.Arguments = args; } new public void Start () { - SparkleHelpers.DebugInfo ("Cmd", StartInfo.FileName + " " + StartInfo.Arguments); + SparkleHelpers.DebugInfo ("Cmd", "git " + StartInfo.Arguments); base.Start (); } } diff --git a/SparkleShare/Mac/SparkleController.cs b/SparkleShare/Mac/SparkleController.cs index 78f24a15..9c9b0669 100755 --- a/SparkleShare/Mac/SparkleController.cs +++ b/SparkleShare/Mac/SparkleController.cs @@ -42,20 +42,25 @@ namespace SparkleShare { public SparkleController () : base () { string content_path = - Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory) - .ToString (); + Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory).ToString (); string app_path = Directory.GetParent (content_path).ToString (); string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl"); + // Needed for Growl Dlfcn.dlopen (growl_path, 0); NSApplication.Init (); + // Let's use the bundled git first SparkleBackend.DefaultBackend.Path = Path.Combine (NSBundle.MainBundle.ResourcePath, - "git", "bin", "git"); + "git", "libexec", "git-core", "git"); + + SparkleGit.ExecPath = + Path.Combine (NSBundle.MainBundle.ResourcePath, + "git", "libexec", "git-core"); }