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:

    If there is nothing new on the earth, still the traveler always has a resource in the skies. They are constantly turning a new page to view. The wind sets the types on this blue ground, and the inquiring may always read a new truth there.
    Henry David Thoreau (1817–1862)

    Eye of newt and toe of frog,
    Wool of bat and tongue of dog,
    Adder’s fork and blind-worm’s sting,
    Lizard’s leg and owlet’s wing,
    For a charm of powerful trouble,
    Like a hell-broth boil and bubble.
    William Shakespeare (1564–1616)