Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /

Chapter 9 - Desktop Manager

For quick access to the resources it needs, the Finder maintains a central desktop database of information about the files and directories on a volume. The Finder updates the database when applications are added, moved, renamed, or deleted.

Normally, your application won't need to use the information in the desktop database or to use Desktop Manager routines to manipulate it. Instead, your application should let the Finder manipulate the desktop database and handle such Desktop Manager tasks as maintaining user comments associated with files and managing the icons used by applications.

Although there may be instances where you would like to gain access to the desktop database by using Desktop Manager routines, you should never change, add to, or remove any of this information. Manipulating the desktop database is likely to wreak havoc on your users' systems.
In case you should discover some important need to retrieve information from the desktop database or even to change the desktop database from within your application, Desktop Manager routines are provided for you to do so. While your application probably won't ever need to use them, for the sake of completeness they are described in this chapter.

Much of the information in the desktop database comes from the bundle resources for applications and other files on the volume. (See the chapter "Finder Interface" in Inside Macintosh: Macintosh Toolbox Essentials for a discussion on setting the bundle bit of an application so that its bundled resources get stored in the desktop database.) The desktop database contains all icon definitions and their associated file types. It lists all the file types that each application can open and all copies or versions of the application that's listed as the creator of a file. The desktop database also lists the location of each application on the disk and any comments that the user has added to the information windows for desktop objects. The Desktop Manager provides routines that let your application retrieve this information from the desktop database.

The Finder maintains a desktop database for each volume with a capacity greater than 2 MB. For most volumes, such as hard disks, the database is stored on the volume itself. For read-only volumes--such as some compact discs--that don't contain their own desktop database, the Desktop Manager creates one for it and stores it in the System Folder of the boot drive.

If you distribute read-only media, it is generally a good idea to store on each volume both a desktop database (for users running System 7 or later) and a Desktop file (for users running older versions of system software). Create a desktop database on your master volume by pressing Command-Option when booting your system with System 7. Then create a Desktop file by pressing Command-Option and restarting your system with version 6.0.
For compatibility with older versions of system software, the Finder keeps the information for ejectable volumes with a capacity smaller than 2 MB in a resource file instead of in a database.

Although the Desktop Manager provides tools for both reading and changing the desktop database, your application should not ordinarily change anything in the database. You can read the database to retrieve information, such as the icons defined by other applications.

The desktop database doesn't store customized icons (that is, those with resource IDs of -16455 described in the chapter "Finder Interface" in Inside Macintosh: Macintosh Toolbox Essentials), so your application can't retrieve them by using Desktop Manager routines.
If the Translation Manager is available, the desktop database also includes information retrieved from each application's 'open' and 'kind' resources. For information about the information stored in these resources, see the chapter "Translation Manager" in this book.

Chapter Contents
About the Desktop Database
Using the Desktop Manager
Desktop Manager Reference
Data Structure
The Desktop Parameter Block
Locating, Opening, and Closing the Desktop Database
Reading the Desktop Database
Adding to the Desktop Database
Deleting Entries From the Desktop Database
Manipulating the Desktop Database Itself
Summary of the Desktop Manager
Pascal Summary
Data Types
C Summary
Data Types
Assembly-Language Summary
Data Structures
Trap Macros
Result Codes

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996