Re: URLByResolvingBookmarkData not case sensitive
Re: URLByResolvingBookmarkData not case sensitive
- Subject: Re: URLByResolvingBookmarkData not case sensitive
- From: Ken Thomases <email@hidden>
- Date: Tue, 06 Jan 2015 20:20:56 -0600
On Jan 6, 2015, at 7:40 PM, Kyle Sluder <email@hidden> wrote:
> On Jan 6, 2015, at 5:05 PM, Trygve Inda <email@hidden> wrote:
>
>> If I bookmark a file and the case of any folders or the file itself changes,
>> then later when I extract the path from the bookmark I want it to reflect
>> the new case of the path as it now exists.
>
> Use -[NSFileManager componentsToDisplayForPath:]. Then you don’t even need to canonicalize anything yourself.
Yes. Also, the components to display for a path are *not* the display name for each path component. For example, the user never sees /Volumes.
You should try to avoid displaying file paths to the user if at all possible. If you must, try using an NSPathControl. That does additional simplification of the path, like starting paths inside the user's home at the home folder and not showing the parent directories of the home folder (e.g. /Users).
If you really, really need to canonicalize a URL, you can try converting it to a file reference URL using -fileReferenceURL and then back to a file path URL using -filePathURL. See the documentation for -fileReferenceURL for caveats. Also, this conversion can produce unexpected results in the face of symlinks and/or hard links.
Regards,
Ken
_______________________________________________
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