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

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2017-05-05 22:25:25 +0300
committerJan Kotas <jkotas@microsoft.com>2017-05-05 23:08:33 +0300
commit6f3eda069873ed25fc2a0ca6c225f98812fa5de6 (patch)
treed9a27720e42bca80199315a3350dbb32b57f36c8 /src/System.Private.CoreLib/shared
parent6ebb86ecf2c96472847dce1f1e8514380f7d144b (diff)
Fixup CoreLib mirror glitch
https://github.com/dotnet/coreclr/pull/11403/ did not get ported correctly
Diffstat (limited to 'src/System.Private.CoreLib/shared')
-rw-r--r--src/System.Private.CoreLib/shared/System/IO/Path.cs24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/System.Private.CoreLib/shared/System/IO/Path.cs b/src/System.Private.CoreLib/shared/System/IO/Path.cs
index b3a8783c3..9feb2873d 100644
--- a/src/System.Private.CoreLib/shared/System/IO/Path.cs
+++ b/src/System.Private.CoreLib/shared/System/IO/Path.cs
@@ -76,19 +76,23 @@ namespace System.IO
// "\\server\share").
public static string GetDirectoryName(string path)
{
- if (path != null)
+ if (string.IsNullOrWhiteSpace(path))
{
- PathInternal.CheckInvalidPathChars(path);
- path = PathInternal.NormalizeDirectorySeparators(path);
- int root = PathInternal.GetRootLength(path);
+ if (path == null) return null;
+ throw new ArgumentException(SR.Arg_PathIllegal, nameof(path));
+ }
- int i = path.Length;
- if (i > root)
- {
- while (i > root && !PathInternal.IsDirectorySeparator(path[--i])) ;
- return path.Substring(0, i);
- }
+ PathInternal.CheckInvalidPathChars(path);
+ path = PathInternal.NormalizeDirectorySeparators(path);
+ int root = PathInternal.GetRootLength(path);
+
+ int i = path.Length;
+ if (i > root)
+ {
+ while (i > root && !PathInternal.IsDirectorySeparator(path[--i])) ;
+ return path.Substring(0, i);
}
+
return null;
}