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 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 Path;

View file

@ -76,10 +76,6 @@ namespace SparkleShare {
if (show_help)
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
string controller_name;
switch (SparkleShare.Platform) {
@ -172,11 +168,13 @@ namespace SparkleShare {
static PlatformID Platform {
get {
IntPtr buf = IntPtr.Zero;
try {
buf = Marshal.AllocHGlobal (8192);
if (uname (buf) == 0 && Marshal.PtrToStringAnsi (buf) == "Darwin")
return PlatformID.MacOSX;
} catch {
} finally {
if (buf != IntPtr.Zero)