Data and Resource Forks
Files
To the user, a file is simply some data stored on a disk. Moreover, to the user it is the smallest unit of data that can be stored on a disk. For example, you can't copy only a part of a file to another disk. |
|
Many operating systems treat a file simply as a named, ordered sequence of bytes. However, each Macintosh file has two forks, known as the data fork and the resource fork. Either or both forks may be empty. |
|
Multiple file forks should be thought of as a mechanism for storing a file's data in multiple pieces, or forks, which appear in all respects to the user as a single file, but are stored at the lowest levels of the file system as individual files. |
Data Forks
The data fork of a file contains the file's data. It is simply a consecutive sequence of bytes of data. In a sense, the data fork of a Macintosh file corresponds to an entire file in operating systems that treat a file simply as a sequence of bytes. The bytes stored in a file's data fork do not have to exhibit any internal structure.
Resource Forks
Think of the resource fork of a file as a kind of database information, stored in pieces called resources, and the system as providing functions to access the data in that database. |
|
The format of the data in the resource fork, as well as that of many resources, is defined by Apple. Because resources are normally accessed with system calls for managing resources, very few applications deal directly with the data structures in resource forks. |
For example:
|
A graphics file may have a custom icon and a preview stored in its resource fork, while the actual picture data is stored in the file's data fork. |
|
A single-file, non-bundled application's code is stored in its data fork, while resources such as dialogs, menus, and strings, are stored in the application's resource fork. |
WARNING:
The Delete Resource Forks and Delete Data Forks commands in File Buddy delete data from files. Either action has the potential to render a file unusable depending on the nature of the data in the file. |
|
Deleting the resource fork of a JPEG file with a custom icon would not damage the file, but would reduce the disk space required for the file. |
|
Deleting the resource fork of a SimpleText file would remove any pictures and style information, but leave the text intact. |
|
Deleting the resource fork of an application will render it useless. |
|
Bottom Line: You should understand the consequences of these commands before using them, and you use them at your own risk. An alert will verify that you really intend to use them, but once done, they cannot be undone. |
Related Topics
|