Instance Method

getRelationship:ofDirectoryAtURL:toItemAtURL:error:

Determines the type of relationship that exists between a directory and item.

Declaration

- (BOOL)getRelationship:(NSURLRelationship *)outRelationship ofDirectoryAtURL:(NSURL *)directoryURL toItemAtURL:(NSURL *)otherURL error:(NSError * _Nullable *)error;

Parameters

outRelationship

A pointer to a variable in which to put the relationship between directoryURL and otherURL. For a list of possible values, see NSURLRelationship.

directoryURL

The URL of the directory that potentially contains the item in otherURL. The URL in this parameter must specify a directory. This parameter must not be nil.

otherURL

The URL of the file or directory whose relationship to directoryURL is being tested. This parameter must not be nil.

error

On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

YES if the relationship between the items was successfully determined, or NO if an error occurred.

Discussion

Use this method to determine the relationship between an item and a directory whose location you already know. If the relationship between the items is determined successfully, this method sets the value of the outRelationship parameter to an appropriate value and returns YES. The directory may contain the item, it may be the same as the item, or it may not have a direct relationship to the item.

See Also

Getting the Relationship Between Items

getRelationship:ofDirectory:inDomain:toItemAtURL:error:

Determines the type of relationship that exists between a system directory and the specified item.