Re: -[NSURL path] "If the path has a trailing slash it is stripped"
Re: -[NSURL path] "If the path has a trailing slash it is stripped"
- Subject: Re: -[NSURL path] "If the path has a trailing slash it is stripped"
- From: Charles Srstka <email@hidden>
- Date: Mon, 09 Apr 2012 21:53:38 -0500
On Apr 9, 2012, at 7:05 PM, Jerry Krinock wrote:
> In current documentation, CFURLCopyStrictPath() still has the ambiguity, but CFURLCopyPath() has been corrected. It says, unambiguously, "nor does it replace percent escape sequences".
The documentation says:
"This function does not resolve the URL against its base and replaces all percent escape sequences. This function's return value does not include a leading slash and uses isAbsolute to report whether the URL's path is absolute.”
That’s not ambiguous; it’s just wrong. The documentation states completely unambiguously that it *does* replace percent escapes and that it *doesn’t* leave the trailing slash on there. Unfortunately, I just tried it and you are correct; the function does not behave in the manner described by the documentation. This is a problem, because if you’re getting a path to provide to a path-based function or method, you need to resolve the percent escapes or it obviously won’t work.
Fortunately, CFURLCopyFileSystemPath with kCFURLPOSIXPathStyle *does* seem to provide a path similar to -path (and I just tested it), so it is doable.
Charles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden