[banshee] Move IsRunningUnix to new Hyena.PlatformUtil class



commit 33733458876033053b589174fa747e82b428e7a1
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Thu Jul 2 15:11:09 2009 -0500

    Move IsRunningUnix to new Hyena.PlatformUtil class

 .../Banshee.GStreamer/Banshee.GStreamer/Service.cs |    2 +-
 .../Banshee.Core/Banshee.Base/PlatformHacks.cs     |    7 ---
 src/Libraries/Hyena/Hyena/PlatformUtil.cs          |   45 ++++++++++++++++++++
 src/Libraries/Hyena/Makefile.am                    |    1 +
 4 files changed, 47 insertions(+), 8 deletions(-)
---
diff --git a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
index 6d46013..1ba8b43 100644
--- a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
+++ b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
@@ -59,7 +59,7 @@ namespace Banshee.GStreamer
             }
             
             // Setup the gst plugins/registry paths if running Windows
-            if (!Banshee.Base.PlatformHacks.IsRunningUnix) {
+            if (!Hyena.PlatformUtil.IsRunningUnix) {
                 string [] gst_paths = new String [] {
                     "gst-plugins"
                 };
diff --git a/src/Core/Banshee.Core/Banshee.Base/PlatformHacks.cs b/src/Core/Banshee.Core/Banshee.Base/PlatformHacks.cs
index 2a4357e..d11073e 100644
--- a/src/Core/Banshee.Core/Banshee.Base/PlatformHacks.cs
+++ b/src/Core/Banshee.Core/Banshee.Base/PlatformHacks.cs
@@ -34,13 +34,6 @@ namespace Banshee.Base
 {
     public static class PlatformHacks
     {
-        public static bool IsRunningUnix {
-            get {
-                int p = (int) System.Environment.OSVersion.Platform;
-                return (p == 4) || (p == 6) || (p == 128);
-            }
-        }
-
         // For the SEGV trap hack (see below)
         [DllImport ("libc")]
         private static extern int sigaction (Mono.Unix.Native.Signum sig, IntPtr act, IntPtr oact);
diff --git a/src/Libraries/Hyena/Hyena/PlatformUtil.cs b/src/Libraries/Hyena/Hyena/PlatformUtil.cs
new file mode 100644
index 0000000..9ff0f1d
--- /dev/null
+++ b/src/Libraries/Hyena/Hyena/PlatformUtil.cs
@@ -0,0 +1,45 @@
+// 
+// PlatformUtil.cs
+//
+// Author:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2009 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace Hyena
+{
+    public static class PlatformUtil
+    {
+        public static bool IsRunningUnix {
+            get {
+                // From http://www.mono-project.com/FAQ:_Technical
+                int p = (int) System.Environment.OSVersion.Platform;
+                return (p == 4) || (p == 6) || (p == 128);
+            }
+        }
+    }
+}
diff --git a/src/Libraries/Hyena/Makefile.am b/src/Libraries/Hyena/Makefile.am
index 0e6f070..a1250f0 100644
--- a/src/Libraries/Hyena/Makefile.am
+++ b/src/Libraries/Hyena/Makefile.am
@@ -111,6 +111,7 @@ SOURCES =  \
 	Hyena/Delegates.cs \
 	Hyena/IUndoAction.cs \
 	Hyena/Log.cs \
+	Hyena/PlatformUtil.cs \
 	Hyena/StringUtil.cs \
 	Hyena/Tests/CryptoUtilTests.cs \
 	Hyena/Tests/StringUtilTests.cs \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]