Interesting NSPathControl Behavior
Interesting NSPathControl Behavior
- Subject: Interesting NSPathControl Behavior
- From: Mike Rossetti <email@hidden>
- Date: Thu, 1 May 2008 19:47:21 -0600
So I've discovered an interesting behavior in NSPathControl and am
wondering if it warrants a Radar.
I'm building up my own presentation of the file path to be shown in
the NSPathControl. Specifically, if the file for which the path is
being presented is in some standard location then I'm abbreviating the
path. As a simple example, if the file is in ~/Documents/FIle.txt
then instead of:
Users > User A > Documents > File.txt
I will show:
Documents > File.txt
The approach I'm taking is to pass a payload (an NSArray) to my
customization of NSPathControl's setObjectValue. In setObjectValue I
compose a string ("/Documents/File.txt") that I pass on to [super
setObjectValue:], which sets up the NSPathComponentCells just fine.
Then I iterate over the pathComponentCells calling each one's setURL.
(And in this example that would be 'file://localhost/Users/User A/
Documents/' for the first cell, and 'file://localhost/Users/User A/
Documents/File.txt' for the second cell.)
Doing this in a forward direction gives the following cell URLs:
0. file://localhost/Users/User A/Documents/File.txt
1. NSPathCell://localhost/Documents/File.txt
Say what?
Interestingly, if I do this in a reverse direction I get the _proper_
cell URLs:
0. file://localhost/Users/User A/Documents/
1. file://localhost/Users/User A/Documents/File.txt
If this is a bug, I'll be happy to write up a small test app to
present the problem.
Mike
_______________________________________________
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