Deprecated NSFileWrapper Methods

A method identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in OS X v10.6

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 in OS X v10.6. Use addFileWrapper: instead.)

- (NSString *)addFileWithPath:(NSString *)node
Parameters
node

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 “Working with Directory Wrappers” in File System Programming Guide for more information.

Special Considerations

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, send it setPreferredFilename: if necessary, and pass the result to addFileWrapper:.

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

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.6.
Declared In
NSFileWrapper.h

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 in OS X v10.6. Use addFileWrapper: instead.)

- (NSString *)addSymbolicLinkWithDestination:(NSString *)node preferredFilename:(NSString *)preferredFilename
Parameters
node

Pathname the new symbolic-link file wrapper is to reference.

preferredFilename

Preferred filename for the new symbolic-link file wrapper.

Return Value

Dictionary key used to store the new file wrapper in the directory’s list of file wrappers. See “Working with Directory Wrappers” in File System Programming Guide for more information.

Special Considerations

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, send it setPreferredFilename: if necessary, and pass the result to addFileWrapper:.

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

This method raises NSInvalidArgumentException if you pass nil or an empty value for preferredFilename.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.6.
Declared In
NSFileWrapper.h

initSymbolicLinkWithDestination:

Initializes the receiver as a symbolic-link file wrapper. (Deprecated in OS X v10.6. Use initSymbolicLinkWithDestinationURL: instead.)

- (id)initSymbolicLinkWithDestination:(NSString *)node
Parameters
node

Pathname the receiver is to represent.

Return Value

Initialized symbolic-link file wrapper referencing node.

Discussion

The receiver is not associated to a file-system node until you save it using writeToFile:atomically:updateFilenames:. It’s also initialized with open permissions; anyone can read or write the disk representations it saves.

Special Considerations

Beginning with OS X v10.6, the preferred method of referring to files is with a file:// URL. Therefore, this method has been deprecated in favor of initSymbolicLinkWithDestinationURL:.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.6.
Declared In
NSFileWrapper.h

initWithPath:

Initializes a file wrapper instance whose kind is determined by the type of file-system node located by the path. (Deprecated in OS X v10.6. Use initWithURL:options:error: instead.)

- (id)initWithPath:(NSString *)node
Parameters
node

Pathname of the file-system node the file wrapper is to represent.

Return Value

File wrapper for node.

Discussion

If node is a directory, this method recursively creates file wrappers for each node within that directory.

Special Considerations

Beginning with OS X v10.6, the preferred method of referring to files is with a file:// URL. Therefore, this method has been deprecated in favor of initWithURL:options:error:.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.6.
Declared In
NSFileWrapper.h

needsToBeUpdatedFromPath:

Indicates whether the file wrapper needs to be updated to match a given file-system node. (Deprecated in OS X v10.6. Use matchesContentsOfURL: instead.)

- (BOOL)needsToBeUpdatedFromPath:(NSString *)node
Parameters
node

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

Return Value

YES when the file wrapper needs to be updated to match node, NO otherwise.

Discussion

This table describes which attributes of the file wrapper and node are compared to determine whether the file wrapper needs to be updated:

File-wrapper type

Comparison determinants

Regular file

Modification date and access permissions.

Directory

Member hierarchy (recursive).

Symbolic link

Destination pathname.

Special Considerations

Beginning with OS X v10.6, the preferred method of referring to files is with a file:// URL. Therefore, this method has been deprecated in favor of matchesContentsOfURL:.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.6.
Declared In
NSFileWrapper.h

symbolicLinkDestination

Provides the pathname referenced by the receiver, which must be a symbolic-link file wrapper. (Deprecated in OS X v10.6. Use symbolicLinkDestinationURL instead.)

- (NSString *)symbolicLinkDestination
Return Value

Pathname the file wrapper references (the destination of the symbolic link the file wrapper represents).

Special Considerations

Beginning with OS X v10.6, the preferred method of referring to files is with a file:// URL. Therefore, this method has been deprecated in favor of symbolicLinkDestinationURL.

This method raises NSInternalInconsistencyException if the receiver is not a symbolic-link file wrapper.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.6.
Declared In
NSFileWrapper.h

updateFromPath:

Updates the file wrapper to match a given file-system node. (Deprecated in OS X v10.6. Use readFromURL:options:error: instead.)

- (BOOL)updateFromPath:(NSString *)path
Return Value

YES if the update is carried out, NO if it isn’t needed.

Discussion

For a directory file wrapper, the contained file wrappers are also sent updateFromPath: messages. If nodes in the corresponding directory on the file system have been added or removed, corresponding file wrappers are released or created as needed.

Special Considerations

Beginning with OS X v10.6, the preferred method of referring to files is with a file:// URL. Therefore, this method has been deprecated in favor of readFromURL:options:error:.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.6.
Declared In
NSFileWrapper.h

writeToFile:atomically:updateFilenames:

Writes a file wrapper’s contents to a given file-system node. (Deprecated in OS X v10.6. Use writeToURL:options:originalContentsURL:error: instead.)

- (BOOL)writeToFile:(NSString *)node atomically:(BOOL)atomically updateFilenames:(BOOL)updateNames
Parameters
node

Pathname of the file-system node to which the receiver’s contents are written.

atomically

YES to write the file safely so that:

  • An existing file is not overwritten

  • The method fails if the file cannot be written in its entirety

NO to overwrite an existing file and ignore incomplete writes.

updateNames

YES to update the receiver’s filenames (its filename and—for directory file wrappers—the filenames of its sub–file wrappers) be changed to the filenames of the corresponding nodes in the file system, after a successful write operation. Use this in Save or Save As operations.

NO to specify that the receiver’s filenames not be updated. Use this in Save To operations.

Return Value

YES when the write operation is successful, NO otherwise.

Special Considerations

Beginning with OS X v10.6, the preferred method of referring to files is with a file:// URL. Therefore, this method has been deprecated in favor of writeToURL:options:originalContentsURL:error:.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.6.
Declared In
NSFileWrapper.h