How Documents Know Their Parents
Every operating system needs a mechanism to associate documents with the applications that created them. When you double-click a Microsoft Word document icon, for example, it's clear that you want Microsoft Word to launch and open the document.
So how does Mac OS X know how to find a document's mommy?
It actually has four different mechanisms.
Your preferences. If you've used the "Always Open with" command to specify a program (Reassigning a certain document—just once), that's the one that opens.
Type/Creator codes. First, it checks to see if the document has an invisible, four-letter Type code and Creator code. It does that because that's how Mac OS 9 used to recognize documents, and Mac OS X wants to ensure compatibility. (Apple used to monitor and track these four-letter codes, in conjunction with the various Mac software companies, so that no two creator codes were alike.)
The Creator code is the same for a program and the documents it creates—MSWD for Microsoft Word, FMP7 for FileMaker Pro, and so on. That's the entire point: The creator code tells the Mac which program to open when you double-click a particular document.
The Type code, meanwhile, specifies the document's file format: GIF, JPEG, TIFF, and so on.
Get Mac OS X Leopard: The Missing Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.