Browse Source

Enabling Windows specific code paths with WIN_PLATFORM

Henric Müller 9 years ago
parent
commit
1cdf024aba
1 changed files with 7 additions and 5 deletions
  1. 7 5
      mcs/class/corlib/System.IO/Path.cs

+ 7 - 5
mcs/class/corlib/System.IO/Path.cs

@@ -284,7 +284,7 @@ namespace System.IO {
 
 			SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
 
-#if !MOBILE
+#if MONO_FEATURE_CAS
 			if (SecurityManager.SecurityEnabled) {
 				new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fullpath).Demand ();
 			}
@@ -297,7 +297,7 @@ namespace System.IO {
 			return InsecureGetFullPath (path);
 		}
 
-#if !MOBILE
+#if WIN_PLATFORM
 		// http://msdn.microsoft.com/en-us/library/windows/desktop/aa364963%28v=vs.85%29.aspx
 		[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
 		private static extern int GetFullPathName(string path, int numBufferChars, StringBuilder buffer, ref IntPtr lpFilePartOrNull); 
@@ -318,11 +318,13 @@ namespace System.IO {
 				buffer = new StringBuilder(length);
 				GetFullPathName(path, length, buffer, ref ptr);
 			}
+
 			return buffer.ToString();
 		}
 
 		internal static string WindowsDriveAdjustment (string path)
 		{
+
 			// three special cases to consider when a drive is specified
 			if (path.Length < 2) {
 				if (path.Length == 1 && (path[0] == '\\' || path[0] == '/'))
@@ -365,7 +367,7 @@ namespace System.IO {
 				string msg = Locale.GetText ("The specified path is not of a legal form (empty).");
 				throw new ArgumentException (msg);
 			}
-#if !MOBILE
+#if WIN_PLATFORM
 			// adjust for drives, i.e. a special case for windows
 			if (Environment.IsRunningOnWindows)
 				path = WindowsDriveAdjustment (path);
@@ -732,7 +734,7 @@ namespace System.IO {
 			else {
 				string ret = String.Join (DirectorySeparatorStr, dirs, 0, target);
 				if (Environment.IsRunningOnWindows) {
-#if !MOBILE					
+#if WIN_PLATFORM
 					// append leading '\' of the UNC path that was lost in STEP 3.
 					if (isUnc)
 						ret = Path.DirectorySeparatorStr + ret;
@@ -878,7 +880,7 @@ namespace System.IO {
 				throw new ArgumentException (Locale.GetText ("Path is empty"));
 			if (path.IndexOfAny (Path.InvalidPathChars) != -1)
 				throw new ArgumentException (Locale.GetText ("Path contains invalid chars"));
-#if !MOBILE				
+#if WIN_PLATFORM
 			if (Environment.IsRunningOnWindows) {
 				int idx = path.IndexOf (':');
 				if (idx >= 0 && idx != 1)