Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not normalize paths from mapped network drives #306

Merged
merged 1 commit into from
Nov 16, 2021
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
7 changes: 6 additions & 1 deletion src/Shared/ExtensionMethods.Shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ public static string ToFullPathInCorrectCase(this string path)

GetFinalPathNameByHandle(stream.SafeFileHandle, stringBuilder, stringBuilder.Capacity, 0);

return stringBuilder.ToString(4, stringBuilder.Capacity - 5);
// The path must begin with \\?\X:in order to be made into a path that Visual Studio can use.
// Mapped network drives return a value like "// \\?\UNC\MachineName\C$" which won't work so the original path must be used
if (stringBuilder.Length > 7 && stringBuilder[0] == '\\' && stringBuilder[1] == '\\' && stringBuilder[2] == '?' && stringBuilder[3] == '\\' && stringBuilder[5] == ':' && stringBuilder[6] == '\\')
{
return stringBuilder.ToString(4, stringBuilder.Capacity - 5);
}
}

return path;
Expand Down