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 FSCreateResourceFork() to create a brand-new resource file or add a resource fork to an existing file, respectively. FSRef fileRef; if (CFURLGetFSRef((CFURLRef)[NSURL fileURLWithPath:resourceFilePath], &fileRef)) { HFSUniStr255 resourceForkName; FSGetResourceForkName(&resourceForkName); if (FSCreateResourceFork(&fileRef, resourceForkName.length, resourceForkName.unicode, 0) == noErr) { ResFileRefNum refNum; if (FSOpenResourceFile(fileRef, resourceForkName.length, resourceForkName.unicode, fsRdWrPerm, &refNum) == noErr) { // write resources here... CloseResFile(refNum); return YES; } } } return NO; Note that the above is creating a resource file in the [classic] resource fork, but unless your files contain existing non-resource data in the data fork, it might be better to create a data fork-based resource file and write resources there. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com