Re: Open Resource File with Cocoa Path
Re: Open Resource File with Cocoa Path
- Subject: Re: Open Resource File with Cocoa Path
- From: David Remahl <email@hidden>
- Date: Fri, 12 Apr 2002 16:41:13 +0200
>
Let's say you have a file with a resource fork and a data fork. Mac OS X
>
sees it (let's call it myFile) as:
>
>
myFile: The data fork.
>
myFile/rsrc: (yes, access it as a directory) The resource fork.
>
myFile/data: The data fork again.
>
>
I believe you can just do:
>
NSData *myResourceFile=[[NSData alloc]
>
initWithContentsOfFile:@"/SomePath/myResourceFile/rsrc"];
>
>
It's actually possible to do this in the Terminal:
>
% cat /SomePath/myResourceFile/rsrc
>
>
The shell only sees it as one file, the data fork, so the autocompletion
>
found in most shells can be confusing for this.
Question is, what will you do with this NSData when you have created it?
Parsing the resource file format seems unnecessarily difficult when you can
have Carbon do it for you...
I can throw into the discussion a few classes that will simplify resource
management:
OFResourceFork (Part of OmniFoundation)
This does have some limitations, and is just made to read resources.
Furthermore, it doesn't work well if you nest calls, as it doesn't set the
current resource file prior to each access...Be careful with that...It also
fails to open the resource file of a file that has no fork. I added a
category to make that an option (to create a fork).
NDResourceFork (Part of NDAppleScriptObject) homepage.mac.com/nathan_day/
Includes both read and write. Haven't used it much.
/ David
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.