ADC Home > Reference Library > Technical Notes > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Resources Contained in the Desktop File

CONTENTS

This Technical Note describes the resources found in the Desktop file. You should not base anything critical on the format of the Desktop file. System 7 already uses another scheme as did AppleShare 2.0 under System 6.0.x.

[May 01 1988]






Introduction

The Desktop file contains almost the same resources for both the Macintosh File System (MFS) and the Hierarchical File System (HFS). This Technical Note describes the resources found in both. This information is for reading only. This means your application can read it but it should never write out information of its own, because the Finder, as well as Macintosh Developer Technical Support, won't like it.

The Desktop is a resource file which contains the folder information on an MFS volume, the "Get Info" comments, the application bundles, 'FREF' and 'ICN#' resources, and information concerning the whereabouts of applications on an HFS disk. Everything except the comments are preloaded when the desktop is opened, making it easier for the Finder to find things.

The contents of the Desktop file are described below. The resource types are the same for both MFS and HFS volumes unless otherwise stated.

'APPL': This resource type is used by the HFS to locate applications. This is used by the Finder to locate the right application when a document is opened. Each application is identified by the creator, the directory number, and the application name. This is used only by HFS.

'BNDL': This resource type contains a copy of all of the bundles for all of the applications that are either on the disk or are the creators of documents that are on the disk. This is used by the Finder to find the right icons for documents and applications. If you have a document whose creator the Finder has not seen yet, it will not be in the Desktop file and the default document icon will be used.

'FREF': This contains a copy of all of the 'FREF' resources referenced in the bundles.

'FCMT': This resource contains all of the "Get Info" comments for applications and documents. On MFS volumes the ID is a hash of the object's name. The hashing algorithm is as follows:

    ; FUNCTION HashString(str: Str255): INTEGER;

    ; The ID for the FCMT returned in function result

    HashString
          MOVE.L   (SP)+,A0       ; get return address
          MOVE.L   (SP)+,A1       ; get string pointer

          MOVEQ    #0,D0          ; get string length
          MOVE.B   (A1)+,D0

          MOVEQ    #0,D2          ; accumulate ID here
    @2
          MOVE.B   (A1)+,D1       ; get next char
          EOR.B    D1,D2          ; XOR in
          ROR.W    #1,D2          ; stir things up
          BMI.S    @1             ; ID must be negative
          NEG.W    D2
    @1
          SUBQ.W   #1,D0          ; loop until done
          BNE.S    @2             ; until end of string

          MOVE     D2,(SP)        ; return the hashed code

For HFS volumes, the ID of the resource is randomly generated using UniqueID. To find the ID of the comment for a file or directory call PBGetCatInfo. The comment ID for a file is kept in ioFlXFndrInfo.fdComment. The comment ID for a directory is kept in ioDrFndrInfo.frComment.

'FOBJ': This resource type contains all of the folder information for an MFS volume. The format of this resource is not available. This is only in an MFS volume's Desktop file.

'ICN#': This resource type contains a copy of all of the 'ICN#' resources referenced in the bundles and any others that may be present.

'STR ': This is a string that identifies the version of the Finder, but it isn't always correct.

Creators: A resource with a type equal to the creator of each application with a bundle is stored in the Desktop file for reference purposes only. The data stored in these resources is for the Finder's use only.

Be aware that if a resource is copied from an application resource file and there is an ID conflict, the Finder will renumber the resource in the Desktop file.

Back to top

References

Inside Macintosh, Volume I, The Finder Interface

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (48K).

Download



Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.