4 ms·
Why would URL be needed to handle file system only paths? They’re different and OS Specific. Rusts Path vs String vs third-party URL strikes the right balance I
by arcticbull 8y ago
Why would URL be needed to handle file system only paths? They’re different and OS Specific. Rusts Path vs String vs third-party URL strikes the right balance IMO. It’s a third thing.
- saagarjha 8y agoFoundation’s URL handles file system paths, among other things. Thus, it is the right choice to do path-based operations.
- arcticbull 8y agoSorta, it's the right choice on iOS and macOS but conceptually filesystem paths are different than URIs even though the same information can be encoded into both. It's weird to have URIs pointing at google (technically valid by means of being the same type) being passed to file-management APIs - only to have them unsurprisingly fail. It subverts the type system by allowing invalid blobs to avoid being caught by the type system. Paths as URIs in contexts where only FS paths are valid is akin to any other stringly-typed API. A third type is more logical: URL, String and FsPath.