namespace System.IO {
-#if NET_2_0
[ComVisible (true)]
public static class Path {
[Obsolete ("see GetInvalidPathChars and GetInvalidFileNameChars methods.")]
public static readonly char[] InvalidPathChars;
-#else
- public sealed class Path {
-
- private Path ()
- {
- }
-
- public static readonly char[] InvalidPathChars;
-#endif
public static readonly char AltDirectorySeparatorChar;
public static readonly char DirectorySeparatorChar;
public static readonly char PathSeparator;
public static string GetFullPath (string path)
{
string fullpath = InsecureGetFullPath (path);
+#if !NET_2_1
if (SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fullpath).Demand ();
}
+#endif
return fullpath;
}
(!dirEqualsVolume && path.Length > 1 && path [1] == VolumeSeparatorChar));
}
-#if NET_2_0
public static char[] GetInvalidFileNameChars ()
{
// return a new array as we do not want anyone to be able to change the values
return sb.ToString ();
}
-#endif
+
// private class methods
private static int findExtension (string path)
AltDirectorySeparatorChar = MonoIO.AltDirectorySeparatorChar;
PathSeparator = MonoIO.PathSeparator;
-#if NET_2_0
// this copy will be modifiable ("by design")
InvalidPathChars = GetInvalidPathChars ();
-#else
- if (Environment.IsRunningOnWindows) {
- InvalidPathChars = new char [15] { '\x00', '\x08', '\x10', '\x11', '\x12', '\x14', '\x15', '\x16',
- '\x17', '\x18', '\x19', '\x22', '\x3C', '\x3E', '\x7C' };
- } else {
- InvalidPathChars = new char [1] { '\x00' };
- }
-#endif
// internal fields
DirectorySeparatorStr = DirectorySeparatorChar.ToString ();
for (int i = 0; i < dirs.Length; i++) {
// WIN32 path components must be trimmed
if (Environment.IsRunningOnWindows)
- dirs[i] = dirs[i].Trim ();
+ dirs[i] = dirs[i].TrimEnd ();
if (dirs[i] == "." || (i != 0 && dirs[i].Length == 0))
continue;