Skip to content

Ensure long paths are handled correctly in calls to Win32 APIs #423

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
Apr 23, 2025

Conversation

jakepetroules
Copy link
Collaborator

Use the same technique being proposed in SwiftSystem and partly-implemented in Foundation.

As a follow-on change, we also need to stop using POSIX filesystem APIs, which are not Unicode or long path aware.

@jakepetroules jakepetroules added the windows Support for the Windows platform label Apr 19, 2025
@jakepetroules
Copy link
Collaborator Author

@swift-ci test

@jakepetroules jakepetroules requested a review from compnerd April 19, 2025 18:55
@jakepetroules
Copy link
Collaborator Author

Same approach as in apple/swift-system#226

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

I think that the FSProxy is better adjusted to simply use Foundation's FileManager for these operations rather than re-implementing them.

@jakepetroules
Copy link
Collaborator Author

Sure, I can do that for the FSProxy bits. Still need our own copy of "withNTPathRepresentation" for LoadLibraryW and any other Win32 APIs we might need to directly call in future which don't have Foundation analogues.

I also fixed up the path handling in Foundation itself, take a look: swiftlang/swift-foundation#1257

@jakepetroules
Copy link
Collaborator Author

Moved the FSProxy changes into #427, as far as existing code goes, this is now just the one-line change to LoadLibraryW.

@jakepetroules
Copy link
Collaborator Author

@swift-ci test

@jakepetroules
Copy link
Collaborator Author

@swift-ci test

Use the same technique being proposed in SwiftSystem and partly-implemented in Foundation.

As a follow-on change, we also need to stop using POSIX filesystem APIs, which are not Unicode or long path aware.
@jakepetroules
Copy link
Collaborator Author

@swift-ci test

@jakepetroules jakepetroules merged commit ac358da into main Apr 23, 2025
3 checks passed
@jakepetroules jakepetroules deleted the windows-paths branch April 23, 2025 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Support for the Windows platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants