getRelationship(_:of:in:toItemAt:)
Determines the type of relationship that exists between a system directory and the specified item.
Declaration
func getRelationship(_ outRelationship: UnsafeMutablePointer<FileManager.URLRelationship>, of directory: FileManager.SearchPathDirectory, in domainMask: FileManager.SearchPathDomainMask, toItemAt url: URL) throwsParameters
- outRelationship:
A pointer to a variable in which to put the relationship between
directoryURLandotherURL. For a list of possible values, see Urlrelationship. - directory:
The search path directory. For a list of possible values, see Searchpathdirectory.
- domainMask:
The file system domain to search. Specify
0for this parameter if you want the file manager to choose the domain that is most appropriate for the specifiedurl. - url:
The URL of the file or directory whose relationship to
directoryURLis being tested. This parameter must not benil.
Discussion
Use this method to determine the relationship between an item and one of the system-specific directories. For example, you might use this method to determine if the specified item is in the user’s Documents directory or is in the trash. If the relationship between the items is determined successfully, this method sets the value of the outRelationship parameter to an appropriate value. 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.