Skip navigation.
 
mlInteresting NSPathControl Behavior
FROM : Mike Rossetti
DATE : Fri May 02 03:47:21 2008

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

Related mailsAuthorDate
mlInteresting NSPathControl Behavior Mike Rossetti May 2, 03:47
mlRe: Interesting NSPathControl Behavior Kyle Sluder May 2, 10:18
mlRe: Interesting NSPathControl Behavior Corbin Dunn May 2, 20:40