Fix FileSecurityState.VerifyPath on Unix
authorStephen Toub <stoub@microsoft.com>
Sun, 26 Apr 2015 14:15:55 +0000 (10:15 -0400)
committerStephen Toub <stoub@microsoft.com>
Sun, 26 Apr 2015 14:15:55 +0000 (10:15 -0400)
FileSecurityState.VerifyPath is throwing an exception if a path contains '?' or '*', but these are valid characters in paths on Unix.  This commit just uses PLATFORM_UNIX to remove this code when compiling for Linux or OSX.

src/mscorlib/src/System/IO/FileSecurityState.cs

index 00133e5..872cf4f 100644 (file)
@@ -25,7 +25,9 @@ namespace System.IO
     [System.Runtime.CompilerServices.FriendAccessAllowed]
     internal class FileSecurityState : SecurityState
     {
+#if !PLATFORM_UNIX
         private static readonly char[] m_illegalCharacters = { '?', '*' };
+#endif // !PLATFORM_UNIX
 
         private FileSecurityStateAccess m_access;
         private String m_userPath;
@@ -125,8 +127,10 @@ namespace System.IO
 
                 System.IO.Path.CheckInvalidPathChars(path);
 
+#if !PLATFORM_UNIX
                 if (path.IndexOfAny( m_illegalCharacters ) != -1)
                     throw new ArgumentException( Environment.GetResourceString( "Argument_InvalidPathChars" ) );
+#endif // !PLATFORM_UNIX
             }
         }
     }