From 930671beffae299c7fd03a42cf5c1ec44a0403ca Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 20 Nov 2010 14:47:18 +0000 Subject: [PATCH] [main] Do proper OS detection --- SparkleShare/SparkleShare.cs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/SparkleShare/SparkleShare.cs b/SparkleShare/SparkleShare.cs index 71e2014d..51fe74cc 100644 --- a/SparkleShare/SparkleShare.cs +++ b/SparkleShare/SparkleShare.cs @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -using Gtk; using Mono.Unix; using Mono.Unix.Native; using System; @@ -44,8 +43,6 @@ namespace SparkleShare { public static void Main (string [] args) { - - SetProcessName ("sparkleshare"); // Use translations Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); @@ -87,16 +84,25 @@ namespace SparkleShare { if (show_help) ShowHelp (p); - // TODO: Detect this properly - string Platform = "Lin"; - if (Platform.Equals ("Lin")) - Controller = new SparkleLinController (); -// else if (Platform.Equals ("Mac")) -// Controller = new SparkleMacController (); -// else if (Platform.Equals ("Win")) -// Controller = new SparkleWinController (); - + switch (Environment.OSVersion.Platform) { + + case PlatformID.Unix: + SetProcessName ("sparkleshare"); + Controller = new SparkleLinController (); + break; + + case PlatformID.MacOSX: + //Controller = new SparkleMacController (); + break; + + case PlatformID.Win32NT: + //Controller = new SparkleWinController (); + break; + + } + + if (!hide_ui) { UI = new SparkleUI (); @@ -144,7 +150,7 @@ namespace SparkleShare { } - // Sets the unix process name to 'sparkleshare' instead of 'mono' + // Sets the Unix process name to 'sparkleshare' instead of 'mono' private static void SetProcessName (string name) {