Windows Extensions,

Unix/Linux Extensions,

Mac Creator Codes

 

A. DOS/Windows File Extensions

  • Under DOS and Windows 3.1, file names were limited to eight characters, followed by a period (.) followed by a maximum of a 3-character extension. Windows 95 and later allow for longer filenames and extensions, even for multiple dots in the file name, but the three letter extension convention is still used havily.

    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?

  • Some file formats are supported primarily on one of the two major platforms, whereas others are cross-platform. Some formats, such as PICT, TEXT and GIF can be read by numerous applications, while other formats are highly application-specific.

    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 the Finder, use ResEdit's Get Info command to inspect or change a file's Type and Creator. Other utilities, such as DropInfo provide the same capability.

    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?

  • "TEXT" is the File Type and "???" is an unknown or missing Creator Code. Macintosh files that have been download or were transferred from a different platform may not have their Type and Creator set properly.
  • I. How to set the File Type and Creator Code of a file on a MAC?

  • From the Finder, use ResEdit's Get Info command to inspect or change a file's Type and Creator. Other utilities, such as DropInfo provide the same capability.

    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:

    1. In a folder or Explorer Window, click View, Options on the Menu Bar. Click on the File Types tab to display the File Types dialog.
    2. Click the New Type button to display the New File Type dialog.
    3. Type a description and a three or more letter extension in the appropriate text boxes. You do not have to type the period.
    4. Click the New button to display the New Action dialog. Type the action you want in the Action text box. To start an application, type Open.
    5. Type the application used to perform the action in the Application text box. Use the complete path to the application and add any desired command line parameters. You can use the Browse button to find the application.
    6. Click OK. Repeat this procedure if you wish to define more than one action.
    7. Select an icon for the new file type if you don't wish to use the default icon or if there is no icon defined (MS-DOS applications).
    8. Click OK to save your new file type.

    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:

    1. Create a new file type as described above.
    2. For each additional extension, perform only steps 1-3 described above and do NOT type a description. Do NOT specify an action.
    3. Click OK
    4. Open the Registry Editor.
    5. Expand the HKEY_CLASSES_ROOTS branch and scroll down the list of extensions until you find the one you entered in step 1.
    6. Highlight the extension and note the text in the right pane of the Registry Editor. This should correspond to what you typed in the Description box.
    7. Locate each additional extension you added in step 2. Highlight the extension.
    8. Double-click the word Default in the right pane. Change the text in the Value data text box in the Edit String dialog to match the text in step 5.
    9. Scroll down past the extensions to the file types. You should find the file type you described in step 1.
    10. Locate the first extension you entered in step 2. Highlight it and press the Delete key. Click OK to confirm the deletion. Repeat this procedure for any remaining extensions.
    11. Close the Registry Editor and check your work by double-clicking on a file with each extension. The desired application should run with the file opened for editing.