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:
- 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.
- 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.
- 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.
- 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:
“In a world which furnishes so many employments which are useful, and so many which are amusing, it is our own fault if we ever know what ennui [boredom] is, or if we are ever driven to the miserable resource of gaming, which corrupts our dispositions, and teaches us a habit of hostility against all mankind.”
—Thomas Jefferson (17431826)
“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 (18171862)