Finder Icons & BNDLs
About Creating Finder Bundles
The Finder employs a scheme of interrelated resources to maintain information on
your application and any documents it creates or uses. After creating an
application, you will want to set up its resources so that the Finder will display a
snappy icon for it and so that users can click-start it by double-clicking its
documents.
Note: ResEdit 2.1 (the latest as of press time), Resorcerer, and other
resource editors now have simplified the icon/bundle creation process.
Check your resource editor manual for details. The following discussion
is still correct, but making icons is no longer the arduous task it once
was. If you don't have ResEdit 2.1 (or later) or Resorcerer 1.0.1 (or
later), you probably have to add icon resources longhand. If so, read on...
In this summary, we will assume you have and are familiar with ResEdit. We'll
also assume that you want two types of icon - one for your application and one for its
documents.
Note: The easiest way to give your application icons is: create a resource with
a type that matches your creator ID; copy the 'BNDL', 'ICN#' and
'FREF' resources from an existing application, then go through and
modify them wherever it looks like you should.
1. When you build your application, give it a creator ID. For instance, we'll use
'MyAp'. The creator ID must be unique to your system. (Note: you're
supposed to register creator IDs with Apple).
2. Pick a file type for your documents. We'll use 'MyDx'.
3. Add a "creator resource" to your application. Its type is the same as your
creator ID ('MyAp') and its ID is 0. It contains a pString that can contain
version information, author credits, and so forth. This text will be displayed in
the I Finder window (unless you create a 'vers' resource, [see below]).
Note: Apple reserves for its own use all creator IDs, file types and resource
types consisting of four lower-case characters. You can give your
applications any other combinations that aren't already taken.
4. Add two 'ICN#' resources to your application.
Use 'ICN#' 1000 for your application.
Use 'ICN#' 1001 for its documents.
5. Add two 'FREF' resources to your application, giving them the same IDs you
used in the 'ICN#' resources.
'FREF' ID 1000 contains file type = 'APPL' and local ID=0.
'FREF' ID 1001 contains file type = 'MyDx' and local ID=1.
6. Add a 'BNDL' resource to your application. Let its ID be 128. This ties
everything together.
Set Owner Name to 'MyAp'
Set Owner ID to 0
Click the "*****" and press N
Set Type to 'ICN#'
Click the "-----" and press N
Set LocalID to 0
Set RsrcID to 1000
Click the "-----" and press N
Set LocalID to 1
Set RsrcID to 1001
Click the "*****" and press N
Set Type to 'FREF'
Click the "-----" and press N
Set LocalID to 0
Set RsrcID to 1000
Click the "-----" and press N
Set LocalID to 1
Set RsrcID to 1001
Note that if your application creates several types of document, you would add
more 'FREF' and 'ICN#' resources and additional items under the 'FREF' and
'ICN#' sections of the 'BNDL'.
7. If you want, you can create a couple of 'vers' resources (IDs 1 and 2). The
pString text in 'vers' 1 is displayed on the version line of the Finder's I
window and the text in 'vers' 2 is displayed beneath the filename in that
window. See TechNote 189.
8. Use a file utility to make sure that your applications Finder attributes show a
file type of 'Appl' and a creator ID of 'MyAp'. The "bundle bit" (bit 13) must be
set and the "inited bit" (bit 8) should be clear. See the FInfo structure and
SetFInfo for related information.
The next time that the Finder encounters your application, it will copy your
'ICN#' and 'FREF' resources into the Desktop file for the parent volume and
thereafter, your application and its documents will be displayed with your icons.
Note: If you change one or more of your icons (or other bundle information),
the Finder won't know about the change, since it will be working with its
own copy in the Desktop file. To make the Finder aware of the changes,
you can force a rebuild of the Desktop by pressing Cmd-Option while
booting the system (or while inserting a diskette).
Thereafter, a double-click on your document files (which have a creator ID of
'MyAp' and a file type of 'MyDx') will start your application. If your application
is already open under MultiFinder, a double-click will open the document. See
GetAppFiles (and its neighbors) in the Segment Loader for a discussion of
click-starting documents.
Whenever you create a new document file (see Create or PBCreate), specify
creatorID ='MyAp' and fileType='MyDx'. You can force a document to take on a
new icon by using SetFInfo or PBSetFInfo. Because of the Finder's internal
caching, the changes may not be noticed for a while.
Note: You should register your creator signatures with MacDTS (Macintosh
Developer Technical Support) to avoid any conflicts with other
applications that have the same creator type.