-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implemented _getFileSystemRepresentation for Windows #2366
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
Conversation
See also: #2367 |
abcba72
to
98f1251
Compare
|
@swift-ci please test linux |
I don't want to bifurcate the API. Also: a buffer of WCHARS can be expressed as a buffer of UInt8s with a certain length requirement, so I don't see why bifurcating types is necessary at all. |
I'm pretty uncomfortable with storing UTF16 encoded strings in a UInt8 buffer. I think it's asking to get a lot of invisible unicode errors on Windows. At the minimum, calling This also doesn't change the public api, only internal. The public |
@millenomi What would you want to see api wise for Windows File System Representations? Shall I just implement the current UInt8 one to return UTF16 data on Windows? |
Correct. I understand the wish for strong typing, but this isn't source-compatible across platforms, and as such it is in direct opposition to a project goal. |
adea383
to
ddc698e
Compare
Alright! Finally cleaned this up a bit. It shouldn't touch any public apis, instead modifying the signatures of the internal |
@swift-ci please test linux |
@swift-ci please test linux |
// directory on the `C:` drive. | ||
while fsr.count > 1 | ||
&& (fsr[fsr.index(before: fsr.endIndex)] == "\\") | ||
&& !(fsr.count == 3 && fsr[fsr.index(fsr.endIndex, offsetBy: -2)] == ":") { |
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.
I wish there was a more elegant way to write this.
LGTM if @millenomi is okay with the restructuring for the getFSR |
To confirm, this PR will mean that that
|
56a2c19
to
ad5f852
Compare
Modified the helper _getFileSystemRepresentation functions to return a UTF16 Windows style path.
Accidentally closed this while keeping it up to date. |
@swift-ci please test linux |
Modified the helper _getFileSystemRepresentation functions to return a
UTF16 Windows style path.
This makes URL.path return a RFC 1808 path on Windows as opposed to the
C:\...
path before. Since.path
would no longer be valid to pass to win32 functions, it adds Windows specific file system standardization forstandardizingPath
andgetFileSystemRepresentation
. Paths should now be represented internally as RFC 1808 paths on Windows, and only converted when being passed to win32 functions.