Skip to content

Conditionalize stripping of \\?\ on it actually being present #974

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

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 10, 2024

As far as I know \\?\ is always returned by GetFinalPathNameByHandleW but it’s better to be safe and actually check instead of unconditionally trimming the first 4 characters from the returned path.

See swiftlang/swift-tools-support-core#485 (comment)

@ahoppen
Copy link
Member Author

ahoppen commented Oct 10, 2024

@swift-ci Please test

@ahoppen ahoppen requested a review from jrflat October 10, 2024 21:28
} else {
pathBaseAddress = UnsafePointer($0.baseAddress!)
}
return try AbsolutePath(String(decodingCString: pathBaseAddress, as: UTF16.self))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: cannot find 'AbsolutePath' in scope - I think we can probably just return the String(decodingCString:as:) here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes. Copied too much from TSC.

@ahoppen ahoppen force-pushed the conditionalize-windows-path-strip branch from 0c683b6 to 79b3148 Compare October 10, 2024 23:28
@ahoppen
Copy link
Member Author

ahoppen commented Oct 10, 2024

@swift-ci Please test

As far as I know `\\?\` is always returned by `GetFinalPathNameByHandleW` but it’s better to be safe and actually check instead of unconditionally trimming the first 4 characters from the returned path.

See swiftlang/swift-tools-support-core#485 (comment)
@ahoppen ahoppen force-pushed the conditionalize-windows-path-strip branch from 79b3148 to 49981aa Compare October 10, 2024 23:51
@ahoppen
Copy link
Member Author

ahoppen commented Oct 11, 2024

@swift-ci Please test

@jrflat
Copy link
Contributor

jrflat commented Oct 11, 2024

@swift-ci please test

@jrflat jrflat merged commit 3f91710 into swiftlang:main Oct 11, 2024
3 checks passed
@ahoppen ahoppen deleted the conditionalize-windows-path-strip branch October 11, 2024 21:15
cthielen pushed a commit to cthielen/swift-foundation that referenced this pull request Nov 8, 2024
…tlang#974)

As far as I know `\\?\` is always returned by `GetFinalPathNameByHandleW` but it’s better to be safe and actually check instead of unconditionally trimming the first 4 characters from the returned path.

See swiftlang/swift-tools-support-core#485 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants