Re: [swift-users] Why can't we get `URL` equal on the same path?

2016-10-14 Thread Keith Smiley via swift-users
In our case, if we accidentally send a URL from the server with a trailing slash, we want that to be equivalent to one without. But yea, if you're manipulating it you might have more problems! Although in our case we add the slash for the case without it. -- Keith Smiley On 10/14, Jens Alfke

Re: [swift-users] Why can't we get `URL` equal on the same path?

2016-10-14 Thread Jens Alfke via swift-users
> On Oct 14, 2016, at 10:20 PM, Keith Smiley wrote: > > FWIW we've overridden URL's equality function in order to get a "more > realistic" > result. We lowercase everything and compare the scheme, host, port, and query, I hope you don’t lowercase everything — the scheme and

Re: [swift-users] Why can't we get `URL` equal on the same path?

2016-10-14 Thread Jens Alfke via swift-users
> On Oct 14, 2016, at 5:16 PM, zh ao via swift-users > wrote: > > 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? I think this is just a weirdness of

Re: [swift-users] Why can't we get `URL` equal on the same path?

2016-10-14 Thread zh ao via swift-users
十月 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 eq

Re: [swift-users] Why can't we get `URL` equal on the same path?

2016-10-14 Thread Greg Parker via swift-users
> On Oct 14, 2016, at 7:33 AM, Zhao Xin via swift-users > 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 =

[swift-users] Why can't we get `URL` equal on the same path?

2016-10-14 Thread Zhao Xin via swift-users
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 ==