Important: The information in this document is obsolete and should not be used for new development.
Using the Finder Interface
The Finder needs quick access to some key information about your application, such as what icons to use when displaying your application and its documents. You supply most of this information in the resource fork of your application file.The Finder extracts this information and uses it to maintain its own database of the resources it needs. The Finder records the location of your application on disk in
this database so that it can find your application quickly when the user opens one of your documents.For compatibility with the Finder, your application should have
- a signature resource, so that the Finder can identify and start up your application when a user double-clicks documents created by your application
- a set of resources that describe icons that visually represent your application and
any documents it creates- a set of file reference resources, to link icons with the file types they represent and
to allow users to launch your application by dragging document icons to your application icon- a bundle resource, to group together your application's signature, icon, and file reference resources
- a size resource, to tell the Finder how much memory to allocate for your applica-
tion when it starts up and whether your application supports various system
software features- either a missing-application name string resource in your application's documents
(to display the name of your application if the user tries to open or print a document created by your application when your application is missing) or an application- missing message string resource in your application's documents (to explain why
the user can't open or print a document used only by your application)
Your application can also make use of these resources:
- Note
- Supply a missing-application name string resource for documents
that you intend for users to open with your application; supply an application-missing message string resource for documents (such
as preferences files) that your application uses but that users
shouldn't open. You supply only one of these resources in a document--never both.
If you sell or distribute data in the form of a document to be used by other applications, you can assist users by providing
- version resources, so that users can easily find out the version of your application and, if applicable, the version of your application's superset of files
- a help resource, which the Finder uses to display your customized Balloon Help message for your application, control panel, system extension, or desk accessory icon
A catalog file exists on every volume to maintain relationships between the files and directories on that volume. (A volume is any storage medium formatted to contain files.) Although it's used mostly by the File Manager, the catalog file also contains information used by the Finder. You can always check the information in the catalog file. In particular, you may want to check the file type or creator for a file, or you may want to check or set one of the Finder flags for a document. When opening a document, your application should check a Finder flag to determine if the document is a stationery pad, and, if it is, your application should copy the document's contents into a new document and open the new document in an untitled window.
- an appropriate file type to allow users to open your document from the Finder by dragging its icon to an application icon or by choosing the Open command from the File menu within an application
- the resources describing an icon family to represent your document to the user
- a missing-application name string resource or an application-missing message string resource, so the Finder can assist users who try to open or print your documents from the Finder
- version resources, so that users can easily find out the version of your document and, if your document file is one of a larger collection of files, the version of the entire superset of files
Your application might wish to use the folders located in the System Folder. Those you're most likely to want to access are Preferences, Temporary Items, and Trash. For example, you might wish to check for the existence of a user's configuration file in Preferences, create a temporary file in Temporary Items, or--if your application runs out of storage when trying to save a file--check how much storage is taken by items in the Trash directory and report this to the user. You can use the
FindFolder
function to get the path information you need to gain access to these system-related directories.In System 7, users can create Finder objects called aliases to aid them in organizing their files. Ordinarily, when the user wants to open or print files, your application does not need to be concerned with whether they are aliases because the Finder resolves aliases before passing them to your application. However, if your application bypasses the Finder (or the Standard File Package, which is described in Inside Macintosh: Files) when manipulating documents, it should check for and resolve aliases itself by using the Alias Manager function
ResolveAliasFile
.The rest of this chapter describes in detail how to use these Finder features in your application.
Subtopics
- Giving a Signature to Your Application and a Creator and a File Type to Your Documents
- Creating Icons for the Finder
- Creating Customized Document Icons
- Creating File Reference Resources
- Creating a Bundle Resource
- How and When the Finder Launches Your Application
- Displaying Messages When the Finder Can't Find Your Application
- Providing Version Resources
- Using Finder Information in the Catalog File
- Supporting Stationery Pads
- Distributing Fonts, Sounds, and Other Movable Resources
- Providing Balloon Help for Nondocument Icons
- Using Aliases
- Using the System Folder and Its Related Directories
- The Desktop Database