Instance Method

matchesContentsOfURL:

Indicates whether the contents of a file wrapper matches a directory, regular file, or symbolic link on disk.

Declaration

- (BOOL)matchesContentsOfURL:(NSURL *)url;

Parameters

url

URL of the file-system node with which to compare the file wrapper.

Return Value

YES when the contents of the file wrapper match the contents of url, NO otherwise.

Discussion

The contents of files are not compared; matching of regular files is based on file modification dates. For a directory, children are compared against the files in the directory, recursively.

Because children of directory file wrappers are not read immediately by the initWithURL:options:error: method unless the NSFileWrapperReadingImmediate reading option is used, even a newly-created directory file wrapper might not have the same contents as the directory on disk. You can use this method to determine whether the file wrapper's contents in memory need to be updated.

If the file wrapper needs updating, use the readFromURL:options:error: method with the NSFileWrapperReadingImmediate reading option.

This table describes which attributes of the file wrapper and file-system node are compared to determine whether the file wrapper matches the node on disk:

File-wrapper type

Comparison determinants

Regular file

Modification date and access permissions.

Directory

Children (recursive).

Symbolic link

Destination pathname.

See Also

Updating File Wrappers

- needsToBeUpdatedFromPath:

Indicates whether the file wrapper needs to be updated to match a given file-system node.

Deprecated
- updateFromPath:

Updates the file wrapper to match a given file-system node.

Deprecated
- readFromURL:options:error:

Recursively rereads the entire contents of a file wrapper from the specified location on disk.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software