<div id="compose" contenteditable="true" style="padding-left: 20px; padding-right: 20px; padding-bottom: 8px;"><div>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? </div><div><br></div><div>ZhaoXin <br><br><div class="acompli_signature">Get <a href="https://aka.ms/o0ukef">Outlook for iOS</a></div><br></div></div>
                <div class="gmail_quote">_____________________________<br>From: Greg Parker <<a dir="ltr" href="mailto:gparker@apple.com" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="0">gparker@apple.com</a>><br>Sent: 星期六, 十月 15, 2016 05:40<br>Subject: Re: [swift-users] Why can't we get `URL` equal on the same path?<br>To: Zhao Xin <<a dir="ltr" href="mailto:owenzx@gmail.com" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="1">owenzx@gmail.com</a>><br>Cc: swift-users <<a dir="ltr" href="mailto:swift-users@swift.org" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="2">swift-users@swift.org</a>><br><br><br><meta content="text/html charset=us-ascii"><br class=""><div><blockquote class=""><div class="">On Oct 14, 2016, at 7:33 AM, Zhao Xin via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif">As you can see, `URL` is not equal but the `path` is. I wonder why urls do not equal here?</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">let</span><span style="font-variant-ligatures:no-common-ligatures" class=""> url = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">URL</span><span style="font-variant-ligatures:no-common-ligatures" class="">(fileURLWithPath: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(209,47,27)" class="">"foo/bar"</span><span style="font-variant-ligatures:no-common-ligatures" class="">, isDirectory: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">false</span><span style="font-variant-ligatures:no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(62, 30, 129);" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> baseURL = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">url</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures:no-common-ligatures" class="">deletingLastPathComponent</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">let</span><span style="font-variant-ligatures:no-common-ligatures" class=""> newURL = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">URL</span><span style="font-variant-ligatures:no-common-ligatures" class="">(fileURLWithPath: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(209,47,27)" class="">"bar"</span><span style="font-variant-ligatures:no-common-ligatures" class="">, isDirectory: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">false</span><span style="font-variant-ligatures:no-common-ligatures" class="">, relativeTo: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">baseURL</span><span style="font-variant-ligatures:no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(62,30,129)" class="">print</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">url</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(62,30,129)" class="">==</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">newURL</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) </span><span style="font-variant-ligatures:no-common-ligatures" class="">// prints false</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(62,30,129)" class="">print</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">url</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">path</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(62,30,129)" class="">==</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">newURL</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">path</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) </span><span style="font-variant-ligatures:no-common-ligatures" class="">// prints true</span></div></div></div></div></blockquote><br class=""></div><div>Here's one reason:</div><div> print(url.baseURL == newURL.baseURL) // prints false</div><br class=""><div class=""><br class=""></div><div class="">-- </div><div class="">Greg Parker <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a> Runtime Wrangler</div><div class=""><br class=""></div><div class=""><br class=""></div><br><br></div>