Resource Fork - How A Resource Fork Is Accessed

How A Resource Fork Is Accessed

Resource forks appear as the extended attribute com.apple.ResourceFork.

Previously resource forks were accessed via the 'Resource Manager' API. This API is now deprecated.

Under the deprecated API:

  1. When a resource fork is accessed, data including the start position and length of the resource data and resource map is read in from the header.
  2. If a resource type to read in has been specified, a check is performed to make sure that type is present in the resource list, and the number of items of data containing that type and their offsets in the resource reference list from the start position of the resource map is found.
  3. The resource ID, the offset of the resource name, the resource properties, and the offset of the data from the start position of the resource data is found.
  4. If resource data with the specified ID or name is present in the resource data, the offset obtained above is accessed, the data length is found, and all the data stored there is read in, and returned as the return value.

File Manager APIs such as PBOpenRF also allowed access to the raw resource fork; however, they should be used only for applications such as copying a file – Apple strongly warns against using the resource fork as a “second data fork.”

From the POSIX interface, the resource fork could be accessed as filename/..namedfork/rsrc or as filename/rsrc; the shorter form was deprecated in OS X 10.4 and removed completely in MacOS X 10.7.

Read more about this topic:  Resource Fork

Famous quotes containing the words resource and/or fork:

    Your kind doesn’t just kill men. You murder their spirits, you strangle their last breath of hope and freedom, so that you, the chosen few, can rule your slaves in ease and luxury. You’re a sadist just like the others, Heiser, with no resource but violence and no feeling but fear, the kind you’re feeling now. You’re drowning, Heiser, drowning in the ocean of blood around this barren little island you call the New Order.
    Curtis Siodmak (1902–1988)

    Every country we conquer feeds us. And these are just a few of the good things we’ll have when this war is over.... Slaves working for us everywhere while we sit back with a fork in our hands and a whip on our knees.
    Curtis Siodmak (1902–1988)