Important: The information in this document is obsolete and should not be used for new development.
MatchAlias
You use theMatchAliasfunction to identify a list of possible matches and pass the list through an optional selection filter. The filter can return more than one possible match.
FUNCTION MatchAlias (fromFile: FSSpecPtr; rulesMask: LongInt; alias: AliasHandle; VAR aliasCount: Integer; aliasList: FSSpecArrayPtr; VAR needsUpdate: Boolean; aliasFilter: AliasFilterProcPtr; yourDataPtr: UNIV Ptr): OSErr;
fromFile- The starting point for a relative search. If you do not want
MatchAliasto perform a relative search, setfromFiletoNIL. If you wantMatchAliasto perform a relative search, pass a pointer to a file system specification record that describes the starting point for the search.rulesMask- A set of rules to guide the resolution. Pass the sum of all of the rules you want to invoke.
alias- A handle to the alias record to be resolved.
aliasCount- On input, the maximum number of possible matches to return. On output, the actual number of matches returned.
aliasList- A pointer to the array that holds the results of the search.
needsUpdate- A Boolean flag that indicates whether the alias record to be resolved needs to be updated.
aliasFilter
An application-defined filter function.yourDataPtr- A pointer to data to be passed to the filter function.
DESCRIPTION
TheMatchAliasfunction resolves the alias record specified by thealiasparameter, following the rules specified by therulesMaskparameter. Then it returns, in the structure specified by thealiasListparameter, a list of possible candidates. TheMatchAliasfunction places, in thealiasCountparameter, the number of
candidates identified.You specify the matching criteria by passing a sum of these constants in the
rulesMaskparameter.
CONST kARMMountVol = $00000001;{mount volume automatically} kARMNoUI = $00000002;{suppress user interface} kARMMultVols = $00000008;{search on multiple volumes} kARMSearch = $00000100;{do a fast search} kARMSearchMore = $00000200;{do an exhaustive search} kARMSearchRelFirst = $00000400;{do a relative search first}Constant descriptions
You must specify at least one of the last three parameters:
kARMMountVol- Automatically try to mount the target's volume if it is not
mounted.kARMNoUI- Stop if a search requires user interaction, such as a password dialog box when mounting a remote volume. If user interaction is needed and
kARMNoUIis in effect, the search fails.kARMMultVols- Search all mounted volumes. The search begins with the volume on which the target resided when the record was created. When you specify a fast search of all mounted volumes,
MatchAliasperforms a formal fast search only on the volume described in the alias record. On all other volumes it looks for the target by ID or by name in the directory with the specified parent directory ID. When you specify an exhaustive search of multiple volumes,MatchAliasperforms the same search on all volumes. When resolving an alias record created byNewAliasMinimalFromFullPath,MatchAliasignores this flag.kARMSearch- Perform a fast search for the alias target. If
kARMSearchRelFirstis not set, perform an absolute search first, followed by a relative search only if the value of thefromFileparameter is notNILand the list of matches is not full.kARMSearchMore- Perform an exhaustive search for the alias target. On HFS volumes, the exhaustive search uses the File Manager function
PBCatSearchto identify candidates with matching creation date, type, and creator. ThePBCatSearchfunction is available only on HFS volumes and only on systems running version 7.0 or later. On MFS volumes or HFS volumes that do not supportPBCatSearch, the exhaustive search makes a series of indexed calls to File Manager functions, using the same search criteria. If you setkARMSearchMoreand either or both ofkARMSearchandkARMSearchRelFirst,MatchAliasperforms the fast search first.kARMSearchRelFirst
IfkARMSearchis also set, perform a relative search before the absolute search. (IfkARMSearchis also set and the target is found through the absolute search,MatchAliassets theneedsUpdateflag toTRUE.) If neitherkARMSearchnorkARMSearchMoreis set, perform only a relative search. IfkARMSearchis not set butkARMSearchMoreis set, perform a relative search followed by an exhaustive search.kARMSearch,kARMSearchMore, andkARMSearchRelFirst.Your application can specify a maximum number of possible matches by setting the
aliasCountparameter.MatchAliaschanges thealiasCountparameter to the
actual number of candidates identified. IfMatchAliasfinds the parent directory on the correct volume but does not find the target, it sets thealiasCountparameter to 1, puts the file system specification record for the target in the results list, and returnsfnfErr. 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, use theFSSpecrecord and the File Manager functionFSpCreateto create a replacement for a missing file.The
needsUpdateflag is a signal to your application that the record might need to be updated. After it identifies a target,MatchAliascompares some key information about the target with the same information in the record. If the information does not match,MatchAliassets theneedsUpdateflag toTRUE. The key information is
The
- the name of the target
- the directory ID of the target's parent
- the file ID or directory ID of the target
- the name and creation date of the volume on which the target resides
MatchAliasfunction also sets theneedsUpdateflag toTRUEif it identifies a list of possible matches rather than a single match or ifkARMsearchRelFirstis set but the target is identified through either an absolute search or an exhaustive search. Otherwise, theMatchAliasfunction sets theneedsUpdateflag toFALSE.MatchAliasalways sets theneedsUpdateflag toFALSEwhen resolving an alias created byNewAliasMinimal. If you want to update the alias record to reflect the final
results of the resolution, callUpdateAlias.The
aliasFilterparameter points to a filter function supplied by your application. The Alias Manager executes this function each time it identifies a possible match and after the search has continued for three seconds without a match. Your filter function returns a Boolean value that determines whether the possible match is discarded (TRUE) or added to the list of possible targets (FALSE). It can also terminate the search by setting the variable parameterquitFlag. See "Filtering Possible Targets" on page 4-25 for a description of the filter function.The
yourDataPtrparameter can point to any data that your application might need in the filter function.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector forMatchAliasare
Trap macro Selector _AliasDispatch $0005 RESULT CODES