> On Oct 14, 2016, at 7:33 AM, Zhao Xin via swift-users <[email protected]> 
> wrote:
> 
> As you can see, `URL` is not equal but the `path` is. I wonder why urls do 
> not equal here?
> 
> let url = URL(fileURLWithPath: "foo/bar", isDirectory: false)
> let baseURL = url.deletingLastPathComponent()
> let newURL = URL(fileURLWithPath: "bar", isDirectory: false, relativeTo: 
> baseURL)
> 
> print(url == newURL) // prints false
> print(url.path == newURL.path) // prints true

Here's one reason:
    print(url.baseURL == newURL.baseURL)  // prints false


-- 
Greg Parker     [email protected] <mailto:[email protected]>     Runtime 
Wrangler


_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to