Contents

addFile(withPath:)

Creates a file wrapper from a given file-system node and adds it to the receiver, which must be a directory file wrapper.

Declaration

func addFile(withPath path: String) -> String

Parameters

  • path:

    File-System node from which to create the file wrapper to add to the directory.

Return Value

Dictionary key used to store the new file wrapper in the directory’s list of file wrappers. See Accessing File Wrapper Identities in File System Programming Guide for more information.

Discussion

Beginning with OS X v10.6, the preferred method of referring to files is with a file:// URL. Instead of using this method, you can instantiate NSFileWrapper with one of the initializers, set its preferredFilename property if necessary, and pass the result to addFileWrapper(_:).

This method raises NSInternalInconsistencyException if the receiver is not a directory file wrapper.

See Also

Accessing File-Wrapper Information