Ref: 10710064
Title: Rebuilding the Desktop and Extension Mapping for the Macintosh
Date:  7/7/88

Copyright 3Com Corporation, 1991.  All rights reserved.

Q:  Can you rebuild the desktop of a sharename?

Situation: A client added an entry into the MAC FS table to map
SLK files to Excel.  Upon rebooting, he found that all previously
existing files with the SLK extension do not get mapped as Excel
documents, though all files created after rebooting do.

Is there a quick way to get the files previously existing to
be recognized as Excel files?  Would rebuilding the desktop of
the sharename be the answer?

A:  Yes, there is a way to rebuild the desktop of a sharename, but it
probably won't help with existing files.  This is because their type and
creator was set permanently the first time they were seen by the Mac,
but this information is not stored in the Desktop file.  The easiest way to
convert these files to the proper icon and type/creator would be to open
them in Excel and Save As... using a different name.  Another way would
be to use a program like ResEdit to change the type and creator of each
file to the type and creator of properly-iconed Excel files.

The way to rebuild the desktop of a Shared Folder is the same as the
way to rebuild it for any volume, with a couple of caveats.  Hold down
the Command and Option keys while _returning_ to the Finder from any
application (note that this doesn't work while MultiFinder is running,
since then the Finder is always running).  If the Shared Folder is saved
to link at startup, you can simply hold down Command and Option when you
boot to have it work.

The caveat is that you should only rebuild the desktop on first-level
Shared Folders--e.g. a user's Home Folder or a server Shared Folder--
because of the way the support files are stored on the server.  Rebuilding
the desktop directly on other Shared Folders will not always work,
although it shouldn't cause major problems if you do it accidentally.

Rebuilding the desktop will not cause reinterpretation of
extensions on PC files.  The extension mapping table is only used
the first time a file is encountered in a directory and that file
has not been previously encountered by a Finder on a client
machine.  Once a file has been encountered, the Finder will
update the file's Mac attributes (including the Type and Creator
returned by the MacFS from the extenstion mapping table), causing
the MacFS to store the information in the hidden MACDIR file in that
directory.  From that point on, that file has the Type and
Creator until it is explicitly changed.

The files that get recreated on the server are the hidden ICON and APPL
files in the first level directory (e.g., homedir or apps-like) above or
in the particular shared folder.  The files are rebuilt by the MacFS in
response to a variety of desktop management calls made by the Finder as
it completely traverses the directory tree for the shared folder (the
MacFS does not do it all by itself in response to a single request).

The reason that you should rebuild the Home Folder instead of a Shared
Folder somewhere within a Home Folder is because 3Com uses a single
desktop database for all shared folders within a single Home Folder,
including that same Home Folder.  If you only rebuild a lower level
Shared Folder, then the Finder will only build a desktop database for
what is within that lower shared folder and the desktop database will
not reflect the state of the folder hierarchy that may exist above and
around the particular shared folder.

The ICON file contains all of the ICON resources (bitmaps) found in all
Mac applications encountered at any level within the Shared Folder.
With each ICON, the type and creator for the icon is also kept so that
icons can be retrieved given a type and creator by the Finder during
normal processing.

The APPL file contains a list of all of the Mac applications encountered
at any level within the Shared Folder and their location on the server.
The Creator or application Signature is also maintained.  This file is
used, for instance, when a document is opened in the Finder.  The Finder
has the document's Creator value in memory, which it uses to invoke a
Mac OS entry point that invokes the 3+ client code, which asks for the
location of the application that corresponds to the given Creator.  The
APPL file is accessed by the MacFS and the application location is
determined and returned in Mac format to the client which then opens the
Mac application, passing it the name and location of the document that
is being "opened".

One thing that is different about rebuilding a 3+ Shared Folder as
opposed to native Mac disks is that you don't lose file and folder
comments created and seen via the Finder's GetInfo menu item ( or
displayed by the PC program MACDIR.EXE (with the /L option) that comes
on the MacFS installation disk.

The "desktop database" is a specialized subset of the full MacFS database
on the server.  It doesn't maintain information on arbitrary individual
files.  From the Mac client side, individual file type and creator attributes
are only modified via a select few Mac File Manager interfaces (all
discussed in Inside Mac Vol 4: SetFInfo, PBSetFInfo, PBHSetFInfo, and
PBSetCatInfo).  These entry points are used by programs like ResEdit and
the Finder to update a file's attributes.
