You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Swift 5.10.1, you get: C:/Test
In Swift 6.0 (August 7 snapshot) you get: /C:/Test
Maybe this is intended, but it definitely breaks my usage of passing file URL paths as arguments into a spawned Process for my build tools.
The text was updated successfully, but these errors were encountered:
gregcotten
changed the title
Windows file URL prepends "/" at beginning of path property
Windows file URL prepends "/" at beginning of path property, breaking compatibility
Aug 15, 2024
@jrflat I believe this is the new behavior of URL, so you might be able to look into this. @gregcotten I'd be interested hearing more about how this breaks your use of Process as I'd expect Process itself should still handle this (as URL.withUnsafeFileSystemRepresentation and FileManager.fileSystemRepresentation which are used to provide file system paths to C APIs should still handle this case and remove the leading slash) so at a minimum we should probably correct Process to account for this (I updated Process to correct the executable path with swiftlang/swift-corelibs-foundation#4999)
Interesting! I guess my issue with path being RFC8089 is that it's a rather large change, especially for me :)
I often use someURL.path as a way of communicating a path to a non-Swift party, like calling out to an external process from Swift with a someURL.path as an argument, or in the case of our Electron app, communicating with their JS backend about presenting a save file dialog with a specified path, etc...
@jmschonfeld Yeah I think we were just discussing there could be merit in moving Windows path logic (replacing / with \, removing leading slash if there's a drive letter) to URL.fileSystemPath, which is vended to URL.path for compatibility. I can look into that.
For example, initialize a simple file URL and print its path:
In Swift 5.10.1, you get:
C:/Test
In Swift 6.0 (August 7 snapshot) you get:
/C:/Test
Maybe this is intended, but it definitely breaks my usage of passing file URL paths as arguments into a spawned
Process
for my build tools.The text was updated successfully, but these errors were encountered: