This matches our new behavior with whitespace paths
public static string GetPathRoot(string path)
{
if (path == null) return null;
- if (string.IsNullOrEmpty(path))
+ if (PathInternal.IsEffectivelyEmpty(path))
throw new ArgumentException(SR.Arg_PathEmpty, nameof(path));
PathInternal.CheckInvalidPathChars(path);
// "\\server\share").
public static string GetDirectoryName(string path)
{
+ if (path == null)
+ return null;
+
if (PathInternal.IsEffectivelyEmpty(path))
- {
- if (path == null) return null;
throw new ArgumentException(SR.Arg_PathEmpty, nameof(path));
- }
PathInternal.CheckInvalidPathChars(path);
path = PathInternal.NormalizeDirectorySeparators(path);