Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mcs/class/corlib/System.IO/ChangeLog8
-rw-r--r--mcs/class/corlib/System.IO/DirectoryInfo.cs2
-rw-r--r--mcs/class/corlib/System.IO/Path.cs33
3 files changed, 23 insertions, 20 deletions
diff --git a/mcs/class/corlib/System.IO/ChangeLog b/mcs/class/corlib/System.IO/ChangeLog
index e28065bdae7..fb8dd1ebe9b 100644
--- a/mcs/class/corlib/System.IO/ChangeLog
+++ b/mcs/class/corlib/System.IO/ChangeLog
@@ -1,5 +1,13 @@
2003-03-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+ * DirectoryInfo.cs: changed ToString to match MS behavior.
+ * Path.cs: further fixes to GetDirectoryName to return null in the
+ same cases that MS does.
+
+ Fixes bug #38387.
+
+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>
diff --git a/mcs/class/corlib/System.IO/DirectoryInfo.cs b/mcs/class/corlib/System.IO/DirectoryInfo.cs
index 21d0329b5a9..78719bd4607 100644
--- a/mcs/class/corlib/System.IO/DirectoryInfo.cs
+++ b/mcs/class/corlib/System.IO/DirectoryInfo.cs
@@ -129,7 +129,7 @@ namespace System.IO {
}
public override string ToString () {
- return OriginalPath;
+ return Path.GetFileName (OriginalPath);
}
}
}
diff --git a/mcs/class/corlib/System.IO/Path.cs b/mcs/class/corlib/System.IO/Path.cs
index b545be4c4d7..aec8e670c17 100644
--- a/mcs/class/corlib/System.IO/Path.cs
+++ b/mcs/class/corlib/System.IO/Path.cs
@@ -94,25 +94,20 @@ namespace System.IO
public static string GetDirectoryName (string path)
{
- if (path != null)
- {
- CheckArgument.Empty (path);
- CheckArgument.WhitespaceOnly (path);
- CheckArgument.PathChars (path);
-
- if (path.Length > 0)
- {
- int nLast = path.LastIndexOfAny (PathSeparatorChars);
- if (nLast == 0)
- nLast++;
-
- if (nLast > 0)
- return path.Substring (0, nLast);
- else
- return String.Empty;
- }
- }
- return path;
+ if (path == null || path == "" || GetPathRoot (path) == path)
+ return null;
+
+ CheckArgument.WhitespaceOnly (path);
+ CheckArgument.PathChars (path);
+
+ int nLast = path.LastIndexOfAny (PathSeparatorChars);
+ if (nLast == 0)
+ nLast++;
+
+ if (nLast > 0)
+ return path.Substring (0, nLast);
+
+ return String.Empty;
}
public static string GetExtension (string path)