In your opinion, `baseURL` is a factor more important than `path`. I can not 
unaccept your answer. But I want to know why? Is there a standard on URL 
equality? 
ZhaoXin 

Get Outlook for iOS

                _____________________________
From: Greg Parker <gpar...@apple.com>
Sent: 星期六, 十月 15, 2016 05:40
Subject: Re: [swift-users]  Why can't we get `URL` equal on the same path?
To: Zhao Xin <owe...@gmail.com>
Cc: swift-users <swift-users@swift.org>



On Oct 14, 2016, at 7:33 AM, Zhao Xin via swift-users <swift-users@swift.org> 
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 falseprint(url.path == newURL.path) // prints 
true
Here's one reason:    print(url.baseURL == newURL.baseURL)  // prints false

-- Greg Parker     gpar...@apple.com     Runtime Wrangler




        
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to