Resource Fork - The Macintosh File System

The Macintosh File System

Further information: Hierarchical File System

Originally conceived and implemented by programmer Bruce Horn, the resource fork was used for three purposes with Macintosh file system. First, it was used to store all graphical data on disk until it was needed, then retrieved, drawn on the screen, and thrown away. This software variant of virtual memory helped Apple to reduce the memory requirements of the Apple Lisa from 1 MB to 128 KB in the Macintosh. Second, because all the pictures and text were stored separately in a resource fork, it could be used to allow a non-programmer to translate an application for a foreign market, a process called internationalization and localization. And finally, it could be used to distribute nearly all of the components of an application in a single file, reducing clutter and simplifying application installation and removal.

The resource fork is implemented in all of the file systems used for system drives on the Macintosh (MFS, HFS and HFS Plus). The presence of a resource fork makes it easy to store a variety of additional information, such as allowing the system to display the correct icon for a file and open it without the need for a file extension in the file name. While access to the data fork works like file access on any other operating system — pick a file, pick a byte offset, read some data — access to the resource fork works more like extracting structured records from a database. Microsoft Windows also has a concept of “resources”, but these are completely different from resources in Mac OS.

The resource fork is sometimes used to store the metadata of a file, although it can also be used for storing the actual data, as was the case with font files in the classic Mac operating systems. Note that the Macintosh file systems also have a separate area for metadata distinct from either the data or resource fork. Being part of the catalogue entry for the file, it is much faster to access this. However, the amount of data stored here is minimal, being just the creation and modification timestamps, the file type and creator codes, fork lengths, and the file name. Some files have only a resource fork. Classic 68k applications are one example, where even the executable code is contained in resources of type ‘CODE’. Later PowerPC binaries store the executable code in the data fork.

As resource forks are supported only on the file systems HFS and HFS Plus, they cannot be used on operating systems which use other file systems. At present, HFS is supported only by the Macintosh operating system, which means that only machines running Mac OS can use resource forks. Even in a Mac OS system, resource forks cannot be used if the Unix File System has been installed. In the HFS Plus file system, which is currently the system most commonly used under Mac OS, settings can be made to allow other forks in addition to the data and resource forks, to create a “multi-fork” application. However, as forks can make it difficult to exchange files with other operating systems, this feature is not in common use. Even in OS X, resource forks are seldom used anymore.

Currently, OS X does support resource forks on Windows SMB shares by creating a hidden file in the same directory with the data fork file, with the characters “._” at the beginning of the file name. However, this may be annoying for some users, especially because some Windows power users always keep hidden files visible. Besides, Windows does not treat those files correctly as the file itself is moved or removed. A few resource fork files created by OS X on an SMB share can be disabled by an Apple supported action.

Read more about this topic:  Resource Fork

Famous quotes containing the words file and/or system:

    I have been a soreheaded occupant of a file drawer labeled “Science Fiction” ... and I would like out, particularly since so many serious critics regularly mistake the drawer for a urinal.
    Kurt Vonnegut, Jr. (b. 1922)

    A person, seasoned with a just sense of the imperfections of natural reason, will fly to revealed truth with the greatest avidity: while the haughty Dogmatist, persuaded that he can erect a compleat system of Theology by the mere help of philosophy, disdains any further aid, and rejects this adventitious instructor.
    David Hume (1711–1776)