Re: Referring to file by Alias ^or^ path

2009-06-03 Thread Jerry Krinock
On 2009 Jun 03, at 17:26, Bill Monk wrote: Given that your category depends on FSNewAliasFromPath, which is 10.5-only, both blocks of #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 can be dispensed with. Hehe. Well, like I said, my code had been "cobbled together over

Referring to file by Alias ^or^ path

2009-06-03 Thread Bill Monk
On Jun 1, 2009, at 6:59 PM, je...@ieee.org wrote: The following is a category on NSData which has two methods, one for converting a path to an alias, and its vice versa. I've cobbled it together from various sources over time. Couple of points... Given that your category depends on FSNewA

Re: Referring to file by Alias ^or^ path

2009-06-02 Thread Ed Wynne
On Jun 3, 2009, at 12:43 AM, Ken Thomases wrote: On Jun 2, 2009, at 9:35 PM, Kyle Sluder wrote: Is -fileSystemRepresentation smart enough to deal with filenames that point to volumes on which the canonicalization is different than that used on HFS+? Its purpose isn't to match the canonicaliza

Re: Referring to file by Alias ^or^ path

2009-06-02 Thread Ken Thomases
On Jun 2, 2009, at 9:35 PM, Kyle Sluder wrote: On Tue, Jun 2, 2009 at 7:22 PM, Michael Ash wrote: This step is unnecessary and pointless (although it was useful on really old OS X versions where the kernel's normalization routines didn't always handle everything correctly) but it is there las

Re: Referring to file by Alias ^or^ path

2009-06-02 Thread Kyle Sluder
On Tue, Jun 2, 2009 at 7:22 PM, Michael Ash wrote: > This step is unnecessary and pointless (although it was useful on > really old OS X versions where the kernel's normalization routines > didn't always handle everything correctly) but it is there last I > checked Is -fileSystemRepresentatio

Re: Referring to file by Alias ^or^ path

2009-06-02 Thread Michael Ash
On Tue, Jun 2, 2009 at 7:51 PM, Nick Zitzmann wrote: > > On Jun 2, 2009, at 5:18 PM, Stephen J. Butler wrote: > >> This should be [path fileSystemRepresentation]; Yes, this is UTF-8, >> but IIRC it puts the string in a certain normalized form before UTF-8 >> encoding it. > > > No, it returns a UTF

Re: Referring to file by Alias ^or^ path

2009-06-02 Thread Nick Zitzmann
On Jun 2, 2009, at 5:18 PM, Stephen J. Butler wrote: This should be [path fileSystemRepresentation]; Yes, this is UTF-8, but IIRC it puts the string in a certain normalized form before UTF-8 encoding it. No, it returns a UTF-8 string. The reason why you should use - fileSystemRepresentation

Re: Referring to file by Alias ^or^ path

2009-06-02 Thread Stephen J. Butler
Couple notes on string encodings... On Tue, Jun 2, 2009 at 4:50 PM, Jerry Krinock wrote: > + (NSData*)aliasRecordFromPath:(NSString*)path { >if ([path length] == 0) { >return nil ; >} > >const char* pathC = [path UTF8String] ; This should be [path fileSystemRepresentation]; Y

Re: Referring to file by Alias ^or^ path

2009-06-02 Thread Jerry Krinock
On 2009 Jun 01, at 17:12, James Walker wrote: Jerry Krinock wrote: My app needs a reference to files that may or may not exist (yet). When the file exists, I prefer to use the Alias because it tracks if the user moves it, etc. But if the file does not exist yet, my + [NSData aliasRecordFro

Re: Referring to file by Alias ^or^ path

2009-06-01 Thread James Walker
Jerry Krinock wrote: My app needs a reference to files that may or may not exist (yet). When the file exists, I prefer to use the Alias because it tracks if the user moves it, etc. But if the file does not exist yet, my +[NSData aliasRecordFromPath:] method (shown below) returns nil. It is

Referring to file by Alias ^or^ path

2009-06-01 Thread Jerry Krinock
My app needs a reference to files that may or may not exist (yet). When the file exists, I prefer to use the Alias because it tracks if the user moves it, etc. But if the file does not exist yet, my + [NSData aliasRecordFromPath:] method (shown below) returns nil. It is implied but not expl