
Windows Extensions,
Unix/Linux Extensions,
Mac Creator Codes
A. DOS/Windows File Extensions
The associations between file extensions and applications are stored in the Windows Registry file. (earlier versions in INI-files)
There are two main limitations to this system:
B. Unix/Linux Extensions
The original Unix/Linux knew no extensions. On a command line system like Unix/Linux there is simply no need for associations. Since there is no mouse on a command line system, there is nothing you can click on. Even for user interaction they were considered as not necessary. There were so few real applications on Unix that it was easy to remember the few files which belonged to a certain application. Even in the 90ths you found on Unix systems only some .sh(shell-archives) some .tar(tar-archives) some .z(compress files) and some .c .o .a (c-compiler ) files. This was nearly all you could find. Today the picture changes: with the advent of Netscape and later some file managers (like Nautilus) extensions became quite normal on Unix too.
C. What are Mac signatures?
The Macintosh doesn't use the three-byte (or more ) extension concept to identify files, but signatures. Signatures are strings of eight bytes, four for the creator (the program which created the file) and four for the file type (text, picture, and so on).
The correspondance between signatures and icons is managed by the Finder, for all programs which exist on a volume, in the Desktop file (an hidden system file which is never shown by the Macintosh but exists on every disk). With System 7 and upwards, the Desktop graduated to a double Desktop DB + Desktop DF,.
D.Where are signatures stored?
These signatures, against what is often told, even by knowledgeable persons, are not saved in the resource fork of each file, but in the catalog tree (on the disk, in a management structure you will never have to look at).
This mistake finds its origin in the fact that the programs (and only the programs, not the data files) put the icons they use in their resource fork and have to declare (in a bundle resource placed in their resource fork) the signature of the files they intend to manage, so that the Finder knows what to do when the user double-clicks on an icon. Another source of errors comes from the fact that some graphic files save in the resource fork a preview picture of the file (thumb nail to display on the desktop).
E. Macintosh File Types and Creator Codes
Each Macintosh file contains a hidden File Type and Creator Code that indicate the file's format and the application that uses it, independent of the file's name. Every Macintosh application has a unique Creator Code. Apple maintains a registry of these Creator Codes to avoid conflicts between vendors. Most document formats have a unique File Type, but not always. Most notably HTML files use the plain text type "TEXT" and are not identified as HTML files per se.
When you double-click a document, the Macintosh Finder searches for the application identified by the file's Creator Code. If it can't find the associated application, the Mac will list other applications that claim to recognize files of the specified File Type. An application interprets a document based on this File Type, such as "TEXT". (Applications all have a File Type of "APPL" which is analagous to the Windows .EXE extension, and tells the Finder that it is an executable).
An application may recognize more than one File Type. For example, deBabelizer can read many graphic file formats, each which have a unique File Type. You can open a document from within any application that understands that document's format, using the File menu's Open command.
Note that File Types and Creator Codes are always exactly four (4) characters and are case-sensitive. Some File Types and Creator Codes have trailing spaces to pad them out to four characters. You can view a file's File Type and Creator Code with several utilities, such as ResEdit or DropInfo.
There are two main advantages to this system:
The main disadvantages to this system:
Other Caveats:
F. How do File Formats vary across platforms?
Note that many Macintosh applications will open files with a recognizable extension. For example, Director for Macintosh can open DIR files with the File menu's Open command, even if the file's File-Type is not set properly.
Some file extensions indicate that a file has been processed or encoded with one or more compression or encoding programs. These are generally used when transferring files via the internet.
G. Determining the File Type and Creator Code of a Macintosh File
From within Director, the FileIO Xtra's getFinderInfo method will return a file's File Type and Creator Code. Because a method can only return one thing, FileIO returns them both in one string, from which you can manually extract the Type and Creator. The first four characters are the Type and the last four characters are the Creator.
Warning: getFinderInfo seems to crash Director, so you may want to use the older FileIO XObject instead (see below)
When using the FileIO Xtra:
set fileXtra = new (Xtra "FileIO")
openFile (fileXtra, filename, mode)
set typeCreator = getFinderInfo (fileXtra)
set type = char 1 to 4 of typeCreator
set creator = char 5 to 8 of typeCreator
When using the FileIO XObject:
set fileObj = FileIO (mNew, fileName, mode)
set typeCreator = fileObj (mGetFinderInfo)
set type = char 1 to 4 of typeCreator
set creator = char 5 to 8 of typeCreator
H. What does a return value from getFinderInfo/mGetFinderInfo of "TEXT????" or "TEXT " indicates?
I. How to set the File Type and Creator Code of a file on a MAC?
From within Director, the FileIO Xtra's setFinderInfo method will set a file's File Type and Creator Code. Note that the Type and Creator are passed within a single string, and a dummy character, such as a space is required between them. Note that this seems to crash on some 68K Mac!
When using the FileIO Xtra:
set fileXtra = new (Xtra "FileIO")
openFile (fileXtra, filename, mode)
set type = "TEXT"
set creator = "ttxt"
setFinderInfo (fileXtra, type && creator)
When using the FileIO XObject, the Type and Creator are separate parameters:
set fileObj = FileIO (mNew, filename, mode)
set type = "TEXT"
set creator = "ttxt"
fileObj (mSetFinderInfo,type, creator)
In the file extension list you find Mac creator codes marked as "(MAC CREATOR CODE)", Mac file types as "(MAC FILE TYPE)" and whole signatures(8chars) as "(MAC SIGNATURE)". In signatures the creator code always comes first followed by file type. Blancs are always replaced by underscore characters. Upper/lower case matters!
FILES DENOTED AS "(MAC FILE_TYPE)" MAY BE CREATOR CODE! IT MAY TAKE SOME TIME TO CLEAR THIS!
PLEASE:
If you're sending MAC signatures/creator codes/file types: please verify carefully the type! Even in material published by universities etc. they are some times mangled.
Appendix: Associating File Extensions under
Windows
To associate a file extension with an application:
Note: You cannot duplicate an extension already registered.
You can change a previously registered file type (but not the extension) by highlighting its description and clicking the Edit button. If you wish to change the extension, you must delete that extension first, then create the new extension as described above.
Associating Multiple Registered File Extensions
You can associate multiple extensions with one file type by doing the following: