Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ protected override bool IsValidPath(string path)
#endif

// Make sure the path is either drive rooted or UNC Path
if (!IsAbsolutePath(path) && !IsUNCPath(path))
if (!IsAbsolutePath(path) && !Utils.PathIsUnc(path))
{
return false;
}
Expand Down Expand Up @@ -4676,7 +4676,7 @@ private bool PathIsReservedDeviceName(string destinationPath, string errorId)
protected override string GetParentPath(string path, string root)
{
string parentPath = base.GetParentPath(path, root);
if (!IsUNCPath(path))
if (!Utils.PathIsUnc(path))
{
parentPath = EnsureDriveIsRooted(parentPath);
}
Expand Down Expand Up @@ -4712,11 +4712,6 @@ private static bool IsAbsolutePath(string path)
return result;
}

private static bool IsUNCPath(string path)
{
return path.StartsWith("\\\\", StringComparison.Ordinal);
}

/// <summary>
/// Determines if the specified path is a root of a UNC share
/// by counting the path separators "\" following "\\". If only
Expand All @@ -4735,7 +4730,7 @@ private static bool IsUNCRoot(string path)

if (!string.IsNullOrEmpty(path))
{
if (IsUNCPath(path))
if (Utils.PathIsUnc(path))
{
int lastIndex = path.Length - 1;

Expand Down Expand Up @@ -4863,8 +4858,7 @@ protected override string NormalizeRelativePath(

if (originalPathComparison.StartsWith(basePathComparison, StringComparison.OrdinalIgnoreCase))
{
bool isUNCPath = IsUNCPath(result);
if (!isUNCPath)
if (!Utils.PathIsUnc(result))
{
// Add the base path back on so that it can be used for
// processing
Expand Down Expand Up @@ -6934,17 +6928,6 @@ private static class NativeMethods
[DllImport("api-ms-win-core-shlwapi-legacy-l1-1-0.dll", CharSet = CharSet.Unicode)]
internal static extern int PathGetDriveNumber(string path);

/// <summary>
/// Determines if a path string is a valid Universal Naming Convention (UNC) path, as opposed to a path based on a drive letter.
/// </summary>
/// <param name="path">
/// Path of the file being executed
/// </param>
/// <returns>Returns TRUE if the string is a valid UNC path; otherwise, FALSE.</returns>
[DllImport("api-ms-win-core-shlwapi-legacy-l1-1-0.dll", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool PathIsUNC(string path);

/// <summary>
/// The API 'PathIsNetworkPath' is not available in CoreSystem.
/// This implementation is based on the 'PathIsNetworkPath' API.
Expand All @@ -6958,7 +6941,7 @@ internal static bool PathIsNetworkPath(string path)
return false;
}

if (PathIsUNC(path))
if (Utils.PathIsUnc(path))
{
return true;
}
Expand Down