Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 4 - Alias Manager / Alias Manager Reference
Alias Manager Routines / Resolving and Reading Alias Records


ResolveAlias

You use the ResolveAlias function to identify the single most likely target of an
alias record.

FUNCTION ResolveAlias (fromFile: FSSpecPtr; alias: AliasHandle;
                        VAR target: FSSpec; 
                        VAR wasChanged: Boolean): OSErr;
fromFile
The starting point for a relative search. If you pass a fromFile parameter of NIL, ResolveAlias performs only an absolute search. If you pass
a pointer to a valid FSSpec record in the fromFile parameter, ResolveAlias performs a relative search for the target, followed by
an absolute search only if the relative search fails. If you want to perform an absolute search followed by a relative search, you must use the MatchAlias function.
alias
A handle to the alias record to be resolved and, if necessary, updated.
target
The target of the alias record. This parameter must be a valid
FSSpec record.
wasChanged
A Boolean value indicating whether the alias record to be resolved was updated because it contained some outdated information about the target.
DESCRIPTION
The ResolveAlias function performs a fast search for the target of the alias, as described in "Fast Searches" on page 4-7. If the resolution is successful, ResolveAlias returns (in the target parameter) the FSSpec record for the target file system object, updates the alias record if necessary, and reports (through the wasChanged parameter) whether the record was updated. If the target is on an unmounted AppleShare volume, ResolveAlias automatically mounts the volume. If the target is on an unmounted ejectable volume, ResolveAlias asks the user to insert the volume. The ResolveAlias function exits after it finds one acceptable target.

After it identifies a target, ResolveAlias compares some key information about the target with the information in the alias record. (The description of the MatchAlias function, beginning on page 4-20, lists the key information.) If the information differs, ResolveAlias updates the record to match the target. If it updates the alias
record, ResolveAlias sets the wasChanged parameter to TRUE. Otherwise, it sets
it to FALSE. (ResolveAlias never updates a minimal alias, so it never sets wasChanged to TRUE when resolving a minimal alias.)

When it finds the specified volume and parent directory but fails to find the target file or directory in that location, ResolveAlias returns a result code of fnfErr and fills in the target parameter with a complete FSSpec record describing the target (that is, the volume reference number, parent directory ID, and filename or folder name). The FSSpec record is valid, although the object it describes does not exist. This information is intended as a "hint" that lets you explore possible solutions to the resolution failure. You can, for example, pass the FSSpec record to the File Manager function FSpCreate to create a replacement for a missing file.

The ResolveAlias function displays the standard dialog boxes when it needs input from the user, such as a name and password for mounting a remote volume. The user can cancel the resolution through these dialog boxes.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for ResolveAlias are
Trap macroSelector
_AliasDispatch$0003

RESULT CODES
noErr0No error
nsvErr-35The volume is not mounted
fnfErr-43Target not found, but volume and parent directory found
paramErr-50The value of the target or alias parameter, or both, is NIL, or the alias record is corrupt
dirNFErr-120Parent directory not found
usrCanceledErr-128The user canceled the operation

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996