Re: NSFileManager and Resource Forks

2010-10-27 Thread Charles Srstka
On Oct 27, 2010, at 1:08 PM, Jean-Daniel Dupas wrote: > No, you don't need the Carbon rsrc manager, you need the CoreServices File > Manager, which is available to 64 bits app and AFAIK, the only supported way > to save resource forks. At the time, it wasn’t clear whether he wanted to write th

Re: NSFileManager and Resource Forks

2010-10-27 Thread Charles Srstka
On Oct 27, 2010, at 1:03 PM, Chris Parker wrote: > And while the "..namedfork" bits work now, they're unlikely to continue > working in the future. Has ..namedfork been deprecated? This is news to me. I know that /rsrc was deprecated years ago in favor of /..namedfork/rsrc, but I hadn’t seen an

Re: NSFileManager and Resource Forks

2010-10-27 Thread Sean McBride
On Wed, 27 Oct 2010 20:08:04 +0200, Jean-Daniel Dupas said: >No, you don't need the Carbon rsrc manager, you need the CoreServices >File Manager, which is available to 64 bits app and AFAIK, the only >supported way to save resource forks. >Apple even recommends against using ..namedfork. If you wa

Re: NSFileManager and Resource Forks

2010-10-27 Thread koko
Thanks Greg. Leaks filled! -koko On Oct 27, 2010, at 4:35 PM, Greg Guerin wrote: koko wrote: although I have implemented a different solution, just to note the data fork (the file) does exist, it is nspath in the first line. I don't see nspath being used to create a data-fork file in a

Re: NSFileManager and Resource Forks

2010-10-27 Thread Greg Guerin
koko wrote: although I have implemented a different solution, just to note the data fork (the file) does exist, it is nspath in the first line. I don't see nspath being used to create a data-fork file in any code you posted. It may be in the code you didn't post, or if I've missed it, pl

Re: NSFileManager and Resource Forks

2010-10-27 Thread koko
although I have implemented a different solution, just to note the data fork (the file) does exist, it is nspath in the first line. -koko On Oct 27, 2010, at 3:40 PM, Greg Guerin wrote: koko wrote: NSString *outPath = [nspath stringByAppendingString:@"/..namedfork/ rsrc"]; ok = [fm creat

Re: NSFileManager and Resource Forks

2010-10-27 Thread Greg Guerin
koko wrote: NSString *outPath = [nspath stringByAppendingString:@"/..namedfork/ rsrc"]; ok = [fm createFileAtPath:outPath contents:data attributes:nil]; This won't work. You must first create the file (i.e. create the data fork). Only after the file exists can you open and write to its

Re: NSFileManager and Resource Forks

2010-10-27 Thread koko
FYI ... this works just fine: NSString *dataPath = [[NSBundle mainBundle] pathForResource:@"RSRC" ofType:@"PCSMAC"]; NSString *rsrcPath = [dataPath stringByAppendingString:@"/..namedfork/rsrc"]; NSData *data = [fm contentsAtPath:rsrcPath];

Re: NSFileManager and Resource Forks

2010-10-27 Thread Jean-Daniel Dupas
Le 27 oct. 2010 à 19:52, k...@highrolls.net a écrit : > Here is my code to write a resource fork for a given file. > > NSString *dataPath = [[NSBundle mainBundle] > pathForResource:@"RSRC" ofType:@"PCSMAC"]; > NSString *rsrcPath = [dat

Re: NSFileManager and Resource Forks

2010-10-27 Thread koko
My program creates files, some of which are used by a particular OS9 app. The OS9 app requires a resource fork for the file. -koko On Oct 27, 2010, at 12:04 PM, Chris Parker wrote: What are you really trying to do? In general, resource forks on Mac OS X aren't used anymore. NSFileManager

Re: NSFileManager and Resource Forks

2010-10-27 Thread Chris Parker
What are you really trying to do? In general, resource forks on Mac OS X aren't used anymore. NSFileManager preserves them on file moves and copies for legac. And while the "..namedfork" bits work now, they're unlikely to continue working in the future. .chris On 27 Oct 2010, at 10:52 AM, k...

Re: NSFileManager and Resource Forks

2010-10-27 Thread koko
Here is my code to write a resource fork for a given file. NSString *dataPath = [[NSBundle mainBundle] pathForResource:@"RSRC" ofType:@"PCSMAC"]; NSString *rsrcPath = [dataPath stringByAppendingString:@"/..namedfork/rsrc"]; NSData *data = [fm contentsA

Re: NSFileManager and Resource Forks

2010-10-26 Thread Charles Srstka
On Oct 26, 2010, at 9:26 PM, k...@highrolls.net wrote: > Is there a way to write a resource fork for a file at a path? If you want to read/write individual resources, you’ll have to use the Carbon Resource Manager. However, if you want to read/write the resource map directly to/from the file, y

Re: NSFileManager and Resource Forks

2010-10-26 Thread Steve Christensen
On Oct 26, 2010, at 7:26 PM, k...@highrolls.net wrote: > Is there a way to write a resource fork for a file at a path? I don't believe that NSFileManager knows about resource files, either in the resource or data fork. You can use Resource Manager routines FSCreateResourceFile() or FSCreateRes