2003-03-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Sun, 2 Mar 2003 16:42:52 +0000 (16:42 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Sun, 2 Mar 2003 16:42:52 +0000 (16:42 -0000)
* Path.cs: fixed a couple of bugs reported in #35906.

svn path=/trunk/mcs/; revision=12104

mcs/class/corlib/System.IO/ChangeLog
mcs/class/corlib/System.IO/Path.cs

index 97e15fe28e0e6644f2da8ad7b9ec477a0d2a4c06..e28065bdae72e48e37f22b090ee155a29ff97c22 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * Path.cs: fixed a couple of bugs reported in #35906.
+
 2003-03-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * Directory.cs: fixed bugs #38939 and #38940. No need for separate
index 0f9c1368141d50ce8014b8a98e1ab041ac00cc1b..b545be4c4d79cf3dc8751922947fd6f5325cf0ec 100644 (file)
@@ -103,6 +103,8 @@ namespace System.IO
                                if (path.Length > 0)
                                {
                                        int nLast = path.LastIndexOfAny (PathSeparatorChars);
+                                       if (nLast == 0)
+                                               nLast++;
 
                                        if (nLast > 0)
                                                return path.Substring (0, nLast);
@@ -139,10 +141,10 @@ namespace System.IO
                                throw new ArgumentException ("Illegal characters in path", "path");
 
                        int nLast = path.LastIndexOfAny (PathSeparatorChars);
-                       if (nLast > 0)
+                       if (nLast >= 0)
                                return path.Substring (nLast + 1);
 
-                       return nLast == 0 ? null : path;
+                       return path;
                }
 
                public static string GetFileNameWithoutExtension (string path)