ResolveAlias
ResolveAlias Identify the single most likely target of an AliasRecord
#include <Aliases.h> Alias Manager
OSErr ResolveAlias( fromFile, alias, target, wasChanged);
FSSpec * fromFile ; the starting point for a relative path
AliasHandle alias ; a handle to the AliasRecord to be updated
FSSpec *target ; the target of the AliasRecord
Boolean *wasChanged ; TRUE= a change has taken place
returns Error Code; 0=no error
You use the ResolveAlias to identify the single most likely target of an
fromFile represents the starting point for a relative search. If you pass a
fromFile parameter of NIL, ResolveAlias performs only a direct
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 a direct search only if the relative search fails. If you
want to perform a direct search followed by a relative search, you
must use the MatchAlias function.
alias is a handle to the AliasRecord to be resolved and, if necessary,
updated.
target receives the FSSpec record of the target file system object.
wasChanged is a Boolean value. After it identifies a target, ResolveAlias
compares some key information about the target with the information
in the AliasRecord. (The description of the MatchAlias function
lists the key information.) If the information differs, ResolveAlias
updates the record to match the target. If it updates the AliasRecord,
ResolveAlias sets the wasChanged parameter to TRUE. Otherwise,
it sets it to FALSE. (Because ResolveAlias never updates a minimal
alias, it never sets wasChanged to TRUE when resolving a minimal
alias.)
Returns: an operating system Error Code.
noErr (0) No error
nsvErr (-35) The volume is not mounted
fnfErr (-43) Target not found, but volume and parent directory
found
paramErr (-50) Target, alias, or both are NIL, or the AliasRecord
is corrupt
dirNFErr (-120) Parent directory not found
usrCanceledErr (-128) The user canceled the operation

Notes: ResolveAlias performs a fast search for the target of the alias. If the
resolution is successful, ResolveAlias returns the FSSpec record for the
target file system object through the target parameter, updates the
AliasRecord if necessary, and reports whether the record was updated
through the wasChanged parameter. 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. ResolveAlias exits after it finds one acceptable target.
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, use the FSSpec record to create a replacement for a
missing file with the File Manager function FSpCreate.
ResolveAlias 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.