Move check for slash inside of existing short path check and do a char comparison...
authorJonathan Chambers <joncham@gmail.com>
Thu, 14 Jul 2016 13:40:27 +0000 (09:40 -0400)
committerJonathan Chambers <joncham@gmail.com>
Thu, 14 Jul 2016 13:47:42 +0000 (09:47 -0400)
mcs/class/corlib/System.IO/Path.cs

index 0b2704c1202c9246308dc56342c5c56edaa44f60..d0512f24695a2a5dbe3111080092742268f8da45 100644 (file)
@@ -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;