Re: Best way to get a file path for presentation to the user
Re: Best way to get a file path for presentation to the user
- Subject: Re: Best way to get a file path for presentation to the user
- From: Ken Thomases <email@hidden>
- Date: Fri, 18 Dec 2015 14:33:55 -0600
On Dec 18, 2015, at 12:23 PM, Jens Alfke <email@hidden> wrote:
>
>> On Dec 18, 2015, at 1:24 AM, Graham Cox <email@hidden> wrote:
>>
>> I want to display a path to the user. I have a URL, I need to show the local file path that represents (it’s always a local file path), where the /Users/<username>/ is replaced by ~/
>
> The best methods for this are in NSFileManager:
> - (NSString *)displayNameAtPath:(NSString *)path;
> - (nullable NSArray<NSString *> *)componentsToDisplayForPath:(NSString *)path;
>
> There are other transformations to the path for display besides “~”. For example, the user should never see “/Volumes”, or hidden suffixes like “.app”. And some names get completely localized for display — the “Downloads” directory looks like “Dvökhn¶r” in Elbonian, for example.
And in a UI, it may be better to use an NSPathControl than to display a path as text.
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