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:

    The waste of plenty is the resource of scarcity.
    Thomas Love Peacock (1785–1866)

    Wherever a man separates from the multitude, and goes his own way in this mood, there indeed is a fork in the road, though ordinary travelers may see only a gap in the paling. His solitary path across lots will turn out the higher way of the two.
    Henry David Thoreau (1817–1862)