Csound Csound-dev Csound-tekno Search About

Re: off topic: forks in Macintosh

Date1999-10-18 02:56
Fromrasmus ekman
SubjectRe: off topic: forks in Macintosh
Sergey Batov wrote:
> 
> the thing called 'fork' (data fork, resource fork). Or where can I
> find explanation (easy enough for "PC-thinking")?

The data fork is the standard file, as on pc/unix etc.
The resource fork is a separate file (ie it is not hidden before 
or after the data fork), which usually contains highly structured data. 

Resources are convenient for programmers, since the special system 
resource file operations do most work maintaining the file layout etc, 
and you can access the parts using identifiers or names. 
Also they may be replaced as needed without necessarily disrupting 
the rest of the program.

The following may not reflect the "actual" structure on a Mac 
hard disk, but if you copy Mac files to a PC diskette, you'll 
get up to three components: 

(1) The data fork is the standard file - a wav or aiff file
or any other portable file does not have any resource fork.
 
(2) In every Mac directory there is a subdirectory called 
"Resource.frk". This may (or may not) contain files with the 
same names as the data fork, plus any mac files which only 
have resources and no data. That's the home of the resource forks.

(3) In every directory there is a special file called "Finder.dat".
This has all display information used by the MacOS Finder application:
Position of icons for files the directory etc, and more importantly 
the long file names. Mac names for PC files will be chopped to the 
DOS-type 8.3 format. If you open Finder.dat in a text editor you'll
see the DOS file name followed by the Mac name (there should be 
some app that can do the renaming for us, but I haven't looked hard).

All components are handled transparently by Finder, so the user 
often need not bother about the distinction - move or rename one, 
and the other follows etc. 

This is perhaps not exactly how it really looks on a Mac hard disk,
but it helped me a little understanding how the magic is done.
I suppose it shouldn't be regarded as much more strange than 
other file systems' way of hiding the actual layout of data blocks 
on the hard drive...


Cheers,