Important: The information in this document is obsolete and should not be used for new development.
ResolveAlias
You use theResolveAliasfunction 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
fromFileparameter ofNIL,ResolveAliasperforms only an absolute search. If you pass
a pointer to a validFSSpecrecord in thefromFileparameter,ResolveAliasperforms 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 theMatchAliasfunction.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
FSSpecrecord.wasChanged- A Boolean value indicating whether the alias record to be resolved was updated because it contained some outdated information about the target.
DESCRIPTION
TheResolveAliasfunction performs a fast search for the target of the alias, as described in "Fast Searches" on page 4-7. If the resolution is successful,ResolveAliasreturns (in thetargetparameter) theFSSpecrecord for the target file system object, updates the alias record if necessary, and reports (through thewasChangedparameter) whether the record was updated. If the target is on an unmounted AppleShare volume,ResolveAliasautomatically mounts the volume. If the target is on an unmounted ejectable volume,ResolveAliasasks the user to insert the volume. TheResolveAliasfunction exits after it finds one acceptable target.After it identifies a target,
ResolveAliascompares some key information about the target with the information in the alias record. (The description of theMatchAliasfunction, beginning on page 4-20, lists the key information.) If the information differs,ResolveAliasupdates the record to match the target. If it updates the alias
record,ResolveAliassets thewasChangedparameter toTRUE. Otherwise, it sets
it toFALSE. (ResolveAliasnever updates a minimal alias, so it never setswasChangedtoTRUEwhen 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,
ResolveAliasreturns a result code offnfErrand fills in thetargetparameter with a completeFSSpecrecord describing the target (that is, the volume reference number, parent directory ID, and filename or folder name). TheFSSpecrecord 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 theFSSpecrecord to the File Manager functionFSpCreateto create a replacement for a missing file.The
ResolveAliasfunction 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 forResolveAliasare
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 targetoraliasparameter, or both, isNIL, or the alias record is corruptdirNFErr -120 Parent directory not found usrCanceledErr -128 The user canceled the operation