Important: The information in this document is obsolete and should not be used for new development.
ResolveAlias
You use theResolveAlias
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 ofNIL
,ResolveAlias
performs only an absolute search. If you pass
a pointer to a validFSSpec
record in thefromFile
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 theMatchAlias
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
TheResolveAlias
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 thetarget
parameter) theFSSpec
record for the target file system object, updates the alias record if necessary, and reports (through thewasChanged
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. TheResolveAlias
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 theMatchAlias
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 thewasChanged
parameter toTRUE
. Otherwise, it sets
it toFALSE
. (ResolveAlias
never updates a minimal alias, so it never setswasChanged
toTRUE
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 offnfErr
and fills in thetarget
parameter with a completeFSSpec
record describing the target (that is, the volume reference number, parent directory ID, and filename or folder name). TheFSSpec
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 theFSSpec
record to the File Manager functionFSpCreate
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 forResolveAlias
are
Trap macro Selector _AliasDispatch $0003 RESULT CODES
noErr 0 No error nsvErr -35 The volume is not mounted fnfErr -43 Target not found, but volume and parent directory found paramErr -50 The value of the target
oralias
parameter, or both, isNIL
, or the alias record is corruptdirNFErr -120 Parent directory not found usrCanceledErr -128 The user canceled the operation