Просмотр исходного кода

Changes to follow PlatformID corlib changes.

svn path=/trunk/mcs/; revision=115659
Paolo Molaro 17 лет назад
Родитель
Сommit
bd23e8ade8

+ 5 - 9
mcs/class/System/System.Diagnostics/LocalFileEventLog.cs

@@ -91,7 +91,7 @@ namespace System.Diagnostics
 				// we create an event source directory named after the event log.
 				// This matches what MS does with the registry-based registration.
 				Directory.CreateDirectory (Path.Combine (logDir, sourceData.LogName));
-				if (RunningOnLinux) {
+				if (RunningOnUnix) {
 					ModifyAccessPermissions (logDir, "777");
 					ModifyAccessPermissions (logDir, "+t");
 				}
@@ -345,14 +345,10 @@ namespace System.Diagnostics
 			return sourceDir;
 		}
 
-		private bool RunningOnLinux {
+		private bool RunningOnUnix {
 			get {
-				return ((int) Environment.OSVersion.Platform == 4 ||
-#if NET_2_0
-					Environment.OSVersion.Platform == PlatformID.Unix);
-#else
-					(int) Environment.OSVersion.Platform == 128);
-#endif
+				int p = (int) Environment.OSVersion.Platform;
+				return ((p == 4) || (p == 128) || (p == 6));
 			}
 		}
 
@@ -385,7 +381,7 @@ namespace System.Diagnostics
 				string eventLogType = Environment.GetEnvironmentVariable (EventLog.EVENTLOG_TYPE_VAR);
 				if (eventLogType != null && eventLogType.Length > EventLog.LOCAL_FILE_IMPL.Length + 1)
 					return eventLogType.Substring (EventLog.LOCAL_FILE_IMPL.Length + 1);
-				if (RunningOnLinux) {
+				if (RunningOnUnix) {
 					return "/var/lib/mono/eventlog";
 				} else {
 					return Path.Combine (Environment.GetFolderPath (

+ 3 - 6
mcs/class/System/System.Diagnostics/ProcessStartInfo.cs

@@ -267,13 +267,10 @@ namespace System.Diagnostics
 				if (ext == null)
 					return empty;
 
-#if NET_2_0				
-				const PlatformID unix_platform = PlatformID.Unix;
-#else
-				const PlatformID unix_platform = (PlatformID)4;
-#endif
 				switch (Environment.OSVersion.Platform) {
-				case unix_platform:
+				case (PlatformID)4:
+				case (PlatformID)6:
+				case (PlatformID)128:
 					return empty; // no verb on non-Windows
 				default:
 					RegistryKey rk = null, rk2 = null, rk3 = null;

+ 1 - 1
mcs/class/System/System.IO.Ports/SerialPort.cs

@@ -107,7 +107,7 @@ namespace System.IO.Ports
 				return ports[0];
 			} else {
 				int p = (int)Environment.OSVersion.Platform;
-				if (p == 4 || p == 128)
+				if (p == 4 || p == 128 || p == 6)
 					return "ttyS0"; // Default for Unix
 				else
 					return "COM1"; // Default for Windows

+ 2 - 6
mcs/class/System/Test/System.Diagnostics/ProcessTest.cs

@@ -715,12 +715,8 @@ namespace MonoTests.System.Diagnostics
 
 		static bool RunningOnUnix {
 			get {
-				PlatformID platform = Environment.OSVersion.Platform;
-#if NET_2_0
-				return platform == PlatformID.Unix;
-#else
-				return ((int) platform) == 128;
-#endif
+				int p = (int)Environment.OSVersion.Platform;
+				return ((p == 128) || (p == 4) || (p == 6));
 			}
 		}