private static string GetRelativePath(string relativeTo, string path, StringComparison comparisonType)
{
- if (string.IsNullOrEmpty(relativeTo)) throw new ArgumentNullException(nameof(relativeTo));
- if (PathInternal.IsEffectivelyEmpty(path.AsSpan())) throw new ArgumentNullException(nameof(path));
+ if (relativeTo == null)
+ throw new ArgumentNullException(nameof(relativeTo));
+
+ if (PathInternal.IsEffectivelyEmpty(relativeTo.AsSpan()))
+ throw new ArgumentException(SR.Arg_PathEmpty, nameof(relativeTo));
+
+ if (path == null)
+ throw new ArgumentNullException(nameof(path));
+
+ if (PathInternal.IsEffectivelyEmpty(path.AsSpan()))
+ throw new ArgumentException(SR.Arg_PathEmpty, nameof(path));
+
Debug.Assert(comparisonType == StringComparison.Ordinal || comparisonType == StringComparison.OrdinalIgnoreCase);
relativeTo = GetFullPath(relativeTo);