Merge pull request #3649 from duplicati/feature/fix_root_path_issue

Added support for "splitting" a root path.
This commit is contained in:
Kenneth Skovhede
2019-02-06 15:14:01 +01:00
committed by GitHub
@@ -1482,14 +1482,14 @@ ORDER BY
/// <param name="path">The path to split.</param>
public static KeyValuePair<string, string> SplitIntoPrefixAndName(string path)
{
if (path == null || path.Length == 0)
if (string.IsNullOrEmpty(path))
throw new ArgumentException($"Invalid path: {path}", nameof(path));
int nLast = path.TrimEnd(_pathseparators).LastIndexOfAny(_pathseparators);
if (nLast >= 0)
return new KeyValuePair<string, string>(path.Substring(0, nLast + 1), path.Substring(nLast + 1));
throw new ArgumentException($"Invalid path: {path}", nameof(path));
return new KeyValuePair<string, string>(string.Empty, path);
}
}
}