• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dealing with Resource Forks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dealing with Resource Forks


  • Subject: Re: Dealing with Resource Forks
  • From: Bob Ippolito <email@hidden>
  • Date: Tue, 26 Oct 2004 03:29:58 -0400


On Oct 26, 2004, at 1:53, Daniel DeCovnick wrote:

Hello,

I'm trying to write a simple archiving program (testing an algorithm mostly), but I've run into a problem: while the program works with most Mac OS X files (read: files with data forks only), it doesn't work with files with resource forks. While this isn't the terrible tragedy it would be in the days of OS 9, there are still many files which depend, in some cases entirely, on resource forks (EV Nova plugins, for example), it only archives the data fork of the file and ignores the resource fork entirely. When I un-archive the files, the data fork is complete, but the resource fork is gone. Is there any easy way to deal with the resource fork? Preferably something that doesn't require knowledge of the internal structure of it? I know that Apple's ZIP application splits the forks, and puts the resource fork in a __MACOSX folder before archiving, but I'm not sure at all how that's done or what the actual process is: does it split each resource into its own file or does it keep them all in files based on each resource type, or does it dump them all to a single resource file, and either way, how does it do it?

Incidentally, I'd rather not use Carbon function calls if possible, since I may end up porting this to GNUStep, at least for performance testing.

For files (not folders), on OS X, you can get the resource fork by looking at the file "%@/..namedfork/rsrc" .. it will exist for every file, but if it actually has a resource fork it there will be data in there (size > 0).

As far as the __MACOSX folder goes, it ends up with a bunch of "._%@" files in it. These are the other half of the AppleDouble'd files (an AppleSingle file without the resource fork). Decoding the forks from an AppleSingle file is pretty straightforward, there's an implementation in the Python standard library (in plat-mac, but it's cross-platform). I'm not sure how you would fetch and store the non-rsrc forks (just finder info, I believe) without the Carbon API, but I don't believe they're really necessary.

-bob

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Dealing with Resource Forks (From: Daniel DeCovnick <email@hidden>)

  • Prev by Date: Dealing with Resource Forks
  • Next by Date: Re: detecting an active Internet connection
  • Previous by thread: Dealing with Resource Forks
  • Next by thread: IBPalette Question
  • Index(es):
    • Date
    • Thread