Move the default backend initialisation to SparkleBackend

This commit is contained in:
Hylke Bons 2011-05-25 20:24:25 +01:00
parent 04c3aeca3b
commit cb27d3f551
2 changed files with 11 additions and 5 deletions

View file

@ -22,7 +22,15 @@ namespace SparkleLib {
public class SparkleBackend { public class SparkleBackend {
public static SparkleBackend DefaultBackend; public static SparkleBackend DefaultBackend =
new SparkleBackend ("Git",
new string [4] {
"/opt/local/bin/git",
"/usr/bin/git",
"/usr/local/bin/git",
"/usr/local/git/bin/git"
}
);
public string Name; public string Name;
public string Path; public string Path;

View file

@ -76,10 +76,6 @@ namespace SparkleShare {
if (show_help) if (show_help)
ShowHelp (p); ShowHelp (p);
// Set the default backend for SparkleLib
string [] git_paths = new string [3] {"/usr/bin/git", "/usr/local/git/bin/git", "/usr/local/bin/git"};
SparkleBackend.DefaultBackend = new SparkleBackend ("Git", git_paths);
// Load the right controller for the OS // Load the right controller for the OS
string controller_name; string controller_name;
switch (SparkleShare.Platform) { switch (SparkleShare.Platform) {
@ -172,11 +168,13 @@ namespace SparkleShare {
static PlatformID Platform { static PlatformID Platform {
get { get {
IntPtr buf = IntPtr.Zero; IntPtr buf = IntPtr.Zero;
try { try {
buf = Marshal.AllocHGlobal (8192); buf = Marshal.AllocHGlobal (8192);
if (uname (buf) == 0 && Marshal.PtrToStringAnsi (buf) == "Darwin") if (uname (buf) == 0 && Marshal.PtrToStringAnsi (buf) == "Darwin")
return PlatformID.MacOSX; return PlatformID.MacOSX;
} catch { } catch {
} finally { } finally {
if (buf != IntPtr.Zero) if (buf != IntPtr.Zero)