From a034a2b6279e8fcb4301bb5ffb113e7deaf24565 Mon Sep 17 00:00:00 2001 From: Jonathan Chambers Date: Thu, 14 Jul 2016 09:40:27 -0400 Subject: [PATCH] Move check for slash inside of existing short path check and do a char comparison rather than a string comparison --- mcs/class/corlib/System.IO/Path.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mcs/class/corlib/System.IO/Path.cs b/mcs/class/corlib/System.IO/Path.cs index 0b2704c1202..d0512f24695 100644 --- a/mcs/class/corlib/System.IO/Path.cs +++ b/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; -- 2.25.1