-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Fix longpath directory removal #15467
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8243,6 +8243,12 @@ internal static bool IsReparsePointLikeSymlink(FileSystemInfo fileInfo) | |
|
||
WIN32_FIND_DATA data = default; | ||
string fullPath = Path.TrimEndingDirectorySeparator(fileInfo.FullName); | ||
|
||
if (fullPath.Length > MAX_PATH) | ||
{ | ||
fullPath = "\\\\?\\" + fullPath; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are 2 things we need to check here before we can add the prefix.
I'm also not sure if pwsh/.NET is meant to support the Finally I think that the prefix should always be added rather than when the path exceeds |
||
} | ||
|
||
using (var handle = FindFirstFileEx(fullPath, FINDEX_INFO_LEVELS.FindExInfoBasic, ref data, FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, 0)) | ||
{ | ||
if (handle.IsInvalid) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here
di
is never null and we can remove the null check but we also have no need to do extra Exist check becauseproviderPath
is based onresolvedPath
.