Re: Best way to get a file path for presentation to the user

2015-12-21 Thread Raglan T. Tiger

> On Dec 19, 2015, at 12:31 PM, Lee Ann Rucker  wrote:
> 
> Popup style is appropriate where the most important info is the last part but 
> sometimes they want to see the whole path. Standard style is for where the 
> whole path is important.

It is an excellent control.

-rags
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-20 Thread Uli Kusterer
On 19 Dec 2015, at 09:51, Graham Cox  wrote:
> My use case is an interface that sets up a batch of files for saving in a 
> particular folder. The user chooses the folder using a standard NSOpenPanel, 
> but I want to display the chosen location in the UI so that they don’t need 
> to remember it. I don’t think a NSPathControl is really appropriate for this.

 What gives you that impression? That seems to be exactly what it was made for.

> But I do want the string to be the most understandable for the user. I don’t 
> know really how many average users understand what ~/ means, but it’s 
> probably the best I can do.

 "~" is a nerd thing. If you're in any way in touch with whoever does your 
support, you don't want to add something this confusing to your GUI. What I did 
in UKFilePathView is just shorten the path at the start to a point of interest 
when displaying it, e.g. having the path display just start at the home folder 
and using the file icon to have the user recognize it is a user folder.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.org





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-19 Thread Jens Alfke

> On Dec 19, 2015, at 12:57 AM, Graham Cox  wrote:
> 
> Actually - heh, -displayNameAtPath: really strips it back to just the folder 
> name, with no path at all. That doesn’t tell the user *where* the folder is. 
> Unless they’re already familiar with the location it’s likely less helpful 
> than ~/path/to/folder

Use -componentsToDisplayForPath: instead, then join the strings with a 
separator like “ ‣ ”. Apple does this in a few places, i.e. in the El Capitan 
Spotlights result window when you hold down the Cmd key to see the path to the 
selected hit.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

RE: Best way to get a file path for presentation to the user

2015-12-19 Thread Lee Ann Rucker
NSPathControl really is the best thing - people are used to seeing it, even 
power users who know what those slashes mean. We use it everywhere in Fusion 
settings. Popup style is appropriate where the most important info is the last 
part but sometimes they want to see the whole path. Standard style is for where 
the whole path is important.

From: cocoa-dev-bounces+lrucker=vmware@lists.apple.com 
[cocoa-dev-bounces+lrucker=vmware@lists.apple.com] on behalf of Graham Cox 
[graham@bigpond.com]
Sent: Saturday, December 19, 2015 12:51 AM
To: Jens Alfke
Cc: Cocoa-Dev List List
Subject: Re: Best way to get a file path for presentation to the user

> On 19 Dec 2015, at 5:23 AM, Jens Alfke  wrote:
>
>
>> On Dec 18, 2015, at 1:24 AM, Graham Cox  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// is replaced by ~/
>
> The best methods for this are in NSFileManager:
>
> /* displayNameAtPath: returns an NSString suitable for presentation to the 
> user. For directories which have localization information, this will return 
> the appropriate localized string. This string is not suitable for passing to 
> anything that must interact with the filesystem.
> */
> - (NSString *)displayNameAtPath:(NSString *)path;
>
> /* componentsToDisplayForPath: returns an NSArray of display names for the 
> path provided. Localization will occur as in displayNameAtPath: above. This 
> array cannot and should not be reassembled into an usable filesystem path for 
> any kind of access.
> */
> - (nullable NSArray *)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.
>
> —Jens


Ah, thanks - I was looking through NSFileManager but somehow overlooked these.

My use case is an interface that sets up a batch of files for saving in a 
particular folder. The user chooses the folder using a standard NSOpenPanel, 
but I want to display the chosen location in the UI so that they don’t need to 
remember it. I don’t think a NSPathControl is really appropriate for this. But 
I do want the string to be the most understandable for the user. I don’t know 
really how many average users understand what ~/ means, but it’s probably the 
best I can do.

—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com

This email sent to lruc...@vmware.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-19 Thread Sean McBride
On Sat, 19 Dec 2015 19:51:03 +1100, Graham Cox said:

>I don’t think a NSPathControl is really appropriate for this.

I'm curious why... that's what it's for.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-19 Thread dangerwillrobinsondanger
Though you might consider including an analog of the slightly hidden but 
discoverable way Finder also exposes shell style paths from the Go menu with Go 
to Folder...
The kb shortcut works in open/save panels as well. 

Sent from my iPhone

> On Dec 20, 2015, at 8:00 AM, Graham Cox  wrote:
> 
> I was thinking that I didn’t want the user attempting to use it to navigate 
> the folder hierarchy - but actually just using it for display and setting it 
> to refuse First Responder does the trick pretty nicely. Because it shows the 
> home folder as the user name and has the Home icon it’s much clearer than 
> ~/
> 
> So yes, I think this is the right thing after all.
> 
> 
> ―Graham
> 
> 
>> On 20 Dec 2015, at 8:38 AM, Sean McBride  wrote:
>> 
>> On Sat, 19 Dec 2015 19:51:03 +1100, Graham Cox said:
>> 
>>> I don’t think a NSPathControl is really appropriate for this.
>> 
>> I'm curious why... that's what it's for.
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-19 Thread Graham Cox

> On 19 Dec 2015, at 5:23 AM, Jens Alfke  wrote:
> 
> 
>> On Dec 18, 2015, at 1:24 AM, Graham Cox  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// is replaced by ~/
> 
> The best methods for this are in NSFileManager:
> 
> /* displayNameAtPath: returns an NSString suitable for presentation to the 
> user. For directories which have localization information, this will return 
> the appropriate localized string. This string is not suitable for passing to 
> anything that must interact with the filesystem.
> */
> - (NSString *)displayNameAtPath:(NSString *)path;
> 
> /* componentsToDisplayForPath: returns an NSArray of display names for the 
> path provided. Localization will occur as in displayNameAtPath: above. This 
> array cannot and should not be reassembled into an usable filesystem path for 
> any kind of access.
> */
> - (nullable NSArray *)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.
> 
> —Jens


Ah, thanks - I was looking through NSFileManager but somehow overlooked these.

My use case is an interface that sets up a batch of files for saving in a 
particular folder. The user chooses the folder using a standard NSOpenPanel, 
but I want to display the chosen location in the UI so that they don’t need to 
remember it. I don’t think a NSPathControl is really appropriate for this. But 
I do want the string to be the most understandable for the user. I don’t know 
really how many average users understand what ~/ means, but it’s probably the 
best I can do.

—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-19 Thread Graham Cox

> On 19 Dec 2015, at 7:51 PM, Graham Cox  wrote:
> 
> But I do want the string to be the most understandable for the user. I don’t 
> know really how many average users understand what ~/ means, but it’s 
> probably the best I can do.


Actually - heh, -displayNameAtPath: really strips it back to just the folder 
name, with no path at all. That doesn’t tell the user *where* the folder is. 
Unless they’re already familiar with the location it’s likely less helpful than 
~/path/to/folder

Ideally I wouldn’t expose users to paths of any kind, but since the whole point 
of this feature is export of a series of files, they pretty much have to deal 
with where they end up, since once out of the app they are presumably needed in 
some other context.

—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-19 Thread Graham Cox
I was thinking that I didn’t want the user attempting to use it to navigate the 
folder hierarchy - but actually just using it for display and setting it to 
refuse First Responder does the trick pretty nicely. Because it shows the home 
folder as the user name and has the Home icon it’s much clearer than ~/

So yes, I think this is the right thing after all.


—Graham


> On 20 Dec 2015, at 8:38 AM, Sean McBride  wrote:
> 
> On Sat, 19 Dec 2015 19:51:03 +1100, Graham Cox said:
> 
>> I don’t think a NSPathControl is really appropriate for this.
> 
> I'm curious why... that's what it's for.
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Best way to get a file path for presentation to the user

2015-12-18 Thread Graham Cox
Hi all,

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// is replaced by ~/

Is there an easy, reliable way to do this, or do I have to do a string 
search/replace myself? Going the other way is trivial, I know, but I don’t see 
anything that gives me a displayable path given a URL.

—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-18 Thread Graham Cox
Never mind, I just found it: stringByAbbreviatingWithTildeInPath


—Graham


> On 18 Dec 2015, at 8:24 PM, Graham Cox  wrote:
> 
> Hi all,
> 
> 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// is replaced by ~/
> 
> Is there an easy, reliable way to do this, or do I have to do a string 
> search/replace myself? Going the other way is trivial, I know, but I don’t 
> see anything that gives me a displayable path given a URL.
> 
> —Graham
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com
> 
> This email sent to graham@bigpond.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-18 Thread Jens Alfke

> On Dec 18, 2015, at 1:24 AM, Graham Cox  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// is replaced by ~/

The best methods for this are in NSFileManager:

/* displayNameAtPath: returns an NSString suitable for presentation to the 
user. For directories which have localization information, this will return the 
appropriate localized string. This string is not suitable for passing to 
anything that must interact with the filesystem.
 */
- (NSString *)displayNameAtPath:(NSString *)path;

/* componentsToDisplayForPath: returns an NSArray of display names for the path 
provided. Localization will occur as in displayNameAtPath: above. This array 
cannot and should not be reassembled into an usable filesystem path for any 
kind of access.
 */
- (nullable NSArray *)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.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-18 Thread Ken Thomases
On Dec 18, 2015, at 12:23 PM, Jens Alfke  wrote:
> 
>> On Dec 18, 2015, at 1:24 AM, Graham Cox  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// is replaced by ~/
> 
> The best methods for this are in NSFileManager:

> - (NSString *)displayNameAtPath:(NSString *)path;

> - (nullable NSArray *)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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-18 Thread Uli Kusterer
On 18 Dec 2015, at 21:33, Ken Thomases  wrote:
> On Dec 18, 2015, at 12:23 PM, Jens Alfke  wrote:
>> 
>>> On Dec 18, 2015, at 1:24 AM, Graham Cox  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// is replaced by ~/
>> 
>> The best methods for this are in NSFileManager:
> 
>> - (NSString *)displayNameAtPath:(NSString *)path;
> 
>> - (nullable NSArray *)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.

Definitely recommend using an NSPathControl and to avoid displaying a path at 
all. Most users don't understand file paths. Also keep in mind that display 
names are HFS-style names that may contain slashes, so using a slash as a path 
separator with those can lead to wrong display.

Check out what the "Open recent" submenu does with file names for a good idea 
to follow if you can't use a path control. Particularly how it distinguishes 
between two files with the same name in different locations.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.org





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com