Instance Method

addFileWrapper:

Adds a child file wrapper to the receiver, which must be a directory file wrapper.

Declaration

- (NSString *)addFileWrapper:(NSFileWrapper *)child;

Parameters

child

File wrapper to add to the directory.

Return Value

Dictionary key used to store fileWrapper in the directory’s list of file wrappers. The dictionary key is a unique filename, which is the same as the passed-in file wrapper's preferred filename unless that name is already in use as a key in the directory’s dictionary of children. See Accessing File Wrapper Identities in File System Programming Guide for more information about the file-wrapper list structure.

Discussion

Use this method to add an existing file wrapper as a child of a directory file wrapper. If the file wrapper does not have a preferred filename, set the preferredFilename property to give it one before calling addFileWrapper:. To create a new file wrapper and add it to a directory, use the addRegularFileWithContents:preferredFilename: method.

Special Considerations

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

This method raises NSInvalidArgumentException if the child file wrapper doesn’t have a preferred name.

See Also

Accessing File-Wrapper Information

fileWrappers

The file wrappers contained by a directory file wrapper.

- removeFileWrapper:

Removes a child file wrapper from the receiver, which must be a directory file wrapper.

- addFileWithPath:

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

Deprecated
- addRegularFileWithContents:preferredFilename:

Creates a regular-file file wrapper with the given contents and adds it to the receiver, which must be a directory file wrapper.

- addSymbolicLinkWithDestination:preferredFilename:

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

Deprecated
- keyForFileWrapper:

Returns the dictionary key used by a directory to identify a given file wrapper.

- symbolicLinkDestination

Provides the pathname referenced by the file wrapper object, which must be a symbolic-link file wrapper.

Deprecated
symbolicLinkDestinationURL

The URL referenced by the file wrapper object, which must be a symbolic-link file wrapper.

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