Instance Method インスタンスメソッド

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) throws

Parameters パラメータ

outRelationship

A pointer to a variable in which to put the relationship between directoryURL and otherURL. For a list of possible values, see FileManager.URLRelationship. directoryURLotherURLとの間の関係が置かれることになる変数へのポインタ。可能な値の一覧として、FileManager.URLRelationshipを見てください。

directory

The search path directory. For a list of possible values, see FileManager.SearchPathDirectory. 検索パスディレクトリ。可能な値の一覧として、FileManager.SearchPathDirectoryを見てください。

domainMask

The file system domain to search. Specify 0 for this parameter if you want the file manager to choose the domain that is most appropriate for the specified url. 検索するファイルシステムドメイン。0をこのパラメータに対して指定してください、もしあなたが指定されたurlに対して最も適切であるドメインを選ぶために、ファイルマネージャを望むならば。

url

The URL of the file or directory whose relationship to directoryURL is being tested. This parameter must not be nil. ファイルまたはディレクトリのURL、それのdirectoryURLへの関係がテストされています。このパラメータは、nilであってはいけません。

Return Value 戻り値

true if the relationship between the items was successfully determined, or false if an error occurred. true、もし項目間の関係がうまく決定されたならば、またはfalse、もしエラーが発生したならば。

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. このメソッドを使って、ある項目とシステム固有ディレクトリの1つと間の関係を決定してください。例えば、あなたはこのメソッドを使って、指定された項目がユーザのDocumentsディレクトリの中にあるまたはゴミ箱の中にあるかを決定するかもしれません。項目間の関係がうまく決定されるならば、このメソッドはoutRelationshipパラメータの値を適切な値に設定します。ディレクトリはその項目を含むかもしれません、それはその項目と同じかもしれません、またはそれはその項目に対して直接の関係を持たないかもしれません。

See Also 参照

Getting the Relationship Between Items 項目間の関係を取得する