Important: The information in this document is obsolete and should not be used for new development.
Resolving Alias RecordsThe Alias Manager provides two functions that you can use to resolve alias records:
In general, when you want to identify only the single most likely target of an alias record, you call
- the high-level function
ResolveAlias, which performs a fast search and identifies only one target
- the low-level function
MatchAlias, which can perform a fast search, an exhaustive search, or both and which can return a list of target candidates
ResolveAlias. You call
MatchAliaswhen you want your program
to control the search.
Identifying a Single TargetTo resolve an alias record, you usually call the
ResolveAliasfunction. This function performs a fast search (described earlier in "Fast Searches" on page 4-7) and exits after it identifies one target. The
ResolveAliasfunction compares some key information about the identified target with the information stored in the alias record. If any of the information is different,
ResolveAliasautomatically updates the record.
In the dictionary example illustrated in Figure 4-1 on page 4-6, the application calls
- Like all other Alias Manager functions,
ResolveAliasupdates the record only in memory. Your application is responsible for updating alias records stored on disk when appropriate.
ResolveAliaswith a relative path specification when the user runs the spelling checker on a document with a customized dictionary. If you provide a relative starting point,
ResolveAliasperforms the relative search first.
ResolveAliasfunction reports, in the
wasChangedparameter, whether it updated the alias record. After
ResolveAliasruns, the value of
TRUEif the record was updated and
FALSEif it was not. If you are storing the alias record, check the value of
wasChanged(as well as the function's result code) to see whether to update the stored record after resolving an alias.
ResolveAliascan't resolve the alias record, it returns a nonzero result code. A result code of
ResolveAliashas found the correct volume and parent directory but not the target file or folder. In this case,
ResolveAliasconstructs a valid
FSSpecrecord that describes the target. You can use this record to explore possible solutions to the resolution failure. You can, for example, pass the
FSSpecrecord to the File Manager function
FSpCreateto create a replacement for a missing file.
Identifying Multiple TargetsThe
MatchAliasfunction is a low-level routine that gives your application control over the search algorithms.
You can control
You can also specify a maximum number of candidates that
- whether to attempt an automatic mounting of unmounted volumes
- whether to search on more than one volume
- whether to perform a fast search, an exhaustive search, or both
- what the order of the absolute and relative searches in a fast search should be
- whether to pursue search strategies that require interaction with the user (such as asking for a password while mounting an AppleShare volume)
MatchAliascan identify. For details about controlling a search with the
MatchAliasfunction, see its description beginning on page 4-20.
You can supply an optional filter function that
The filter function determines whether each candidate is added to the list of possible targets. It can also terminate the search. See "Filtering Possible Targets" on page 4-25
- each time it identifies a possible match
- when three seconds have elapsed without a match
for a description of the filter function.
MatchAliasfunction returns, in an array of file system specification records, all candidates that it identifies.