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

URL.path returns forward slashes instead of backslashes on Windows #973

Open
ahoppen opened this issue Oct 10, 2024 · 0 comments
Open

URL.path returns forward slashes instead of backslashes on Windows #973

ahoppen opened this issue Oct 10, 2024 · 0 comments

Comments

@ahoppen
Copy link
Member

ahoppen commented Oct 10, 2024

print(URL(fileURLWithPath: #"C:\Users\alex"#).path)
print(URL(fileURLWithPath: #"C:/Users/alex"#).path)

Both print statements above print C:/Users/alex. I think they should print C:\Users\alex.

Maybe worth noting: Using withUnsafeFileSystemRepresentation returns backslashes. Should that be exposed through URL.path?

URL(fileURLWithPath: #"C:/Users/alex"#).withUnsafeFileSystemRepresentation {
    print(String(cString: $0!))
}
// prints C:\Users\alex
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Oct 21, 2024
…disk

`URL.path` returns forward slashes in the path on Windows (swiftlang/swift-foundation#973) where we expect backslashes. Work around that by defining our own `filePath` property that is backed by `withUnsafeFileSystemRepresentation`, which produces backslashes.

rdar://137963660
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Oct 21, 2024
…disk

`URL.path` returns forward slashes in the path on Windows (swiftlang/swift-foundation#973) where we expect backslashes. Work around that by defining our own `filePath` property that is backed by `withUnsafeFileSystemRepresentation`, which produces backslashes.

rdar://137963660
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Oct 21, 2024
…disk

`URL.path` returns forward slashes in the path on Windows (swiftlang/swift-foundation#973) where we expect backslashes. Work around that by defining our own `filePath` property that is backed by `withUnsafeFileSystemRepresentation`, which produces backslashes.

rdar://137963660
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Oct 21, 2024
…disk

`URL.path` returns forward slashes in the path on Windows (swiftlang/swift-foundation#973) where we expect backslashes. Work around that by defining our own `filePath` property that is backed by `withUnsafeFileSystemRepresentation`, which produces backslashes.

rdar://137963660
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Oct 21, 2024
…disk

`URL.path` returns forward slashes in the path on Windows (swiftlang/swift-foundation#973) where we expect backslashes. Work around that by defining our own `filePath` property that is backed by `withUnsafeFileSystemRepresentation`, which produces backslashes.

rdar://137963660
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Oct 21, 2024
…disk

`URL.path` returns forward slashes in the path on Windows (swiftlang/swift-foundation#973) where we expect backslashes. Work around that by defining our own `filePath` property that is backed by `withUnsafeFileSystemRepresentation`, which produces backslashes.

rdar://137963660
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Oct 21, 2024
…disk

`URL.path` returns forward slashes in the path on Windows (swiftlang/swift-foundation#973) where we expect backslashes. Work around that by defining our own `filePath` property that is backed by `withUnsafeFileSystemRepresentation`, which produces backslashes.

rdar://137963660
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Oct 21, 2024
…disk

`URL.path` returns forward slashes in the path on Windows (swiftlang/swift-foundation#973) where we expect backslashes. Work around that by defining our own `filePath` property that is backed by `withUnsafeFileSystemRepresentation`, which produces backslashes.

rdar://137963660
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

No branches or pull requests

1 participant