Browse Source

Move check for slash inside of existing short path check and do a char comparison rather than a string comparison

Jonathan Chambers 9 years ago
parent
commit
a034a2b627
1 changed files with 4 additions and 3 deletions
  1. 4 3
      mcs/class/corlib/System.IO/Path.cs

+ 4 - 3
mcs/class/corlib/System.IO/Path.cs

@@ -321,10 +321,11 @@ namespace System.IO {
 		internal static string WindowsDriveAdjustment (string path)
 		{
 			// three special cases to consider when a drive is specified
-			if (path == @"\" || path == "/")
-				return Path.GetPathRoot(Directory.GetCurrentDirectory());
-			if (path.Length < 2)
+			if (path.Length < 2) {
+				if (path.Length == 1 && (path[0] == '\\' || path[0] == '/'))
+					return Path.GetPathRoot(Directory.GetCurrentDirectory());
 				return path;
+			}
 			if ((path [1] != ':') || !Char.IsLetter (path [0]))
 				return path;