mircea@jupiter.elcom.pub.ro
)ovidiu@net-community.com
)n.pero@mi.flashnet.it
)rfm@gnu.org
)Version: 1.108.2.1
Date: 2005/03/18 04:17:39
Copyright: (C) 1997-2002 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSFileManager.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
This is a subclass of NSEnumerator
which
provides a full listing of all the files beneath a
directory and its subdirectories. Instances can
be obtained through
[NSFileManager -enumeratorAtPath:]
, or through an initializer in this class. (For compatibility with OS X, use the NSFileManager
method.)
This implementation is optimized and performance should be comparable to the speed of standard Unix tools for large directories.
Returns a dictionary containing the attributes of
the directory at which enumeration started.
The
contents of this dictionary are as produced by
[NSFileManager -fileAttributesAtPath:traverseLink:]
Returns a dictionary containing the attributes of
the file currently being enumerated.
The
contents of this dictionary are as produced by
[NSFileManager -fileAttributesAtPath:traverseLink:]
Initialize instance to enumerate contents at
path, which should be a directory and can
be specified in relative or absolute, and may include
Unix conventions like ' ~
' for user home
directory, which will be appropriately converted
on Windoze systems. The justContents flag, if
set, is equivalent to recurseIntoSubdirectories =
NO
and followSymlinks = NO
, but the implementation will be made more efficient.
Informs the receiver that any descendents of the current directory should be skipped rather than enumerated. Use this to avaoid enumerating the contents of directories you are not interested in.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
- Declared in:
- Foundation/NSFileManager.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
This is the main class for platform-independent management of the local filesystem, which allows you to read and save files, create/list directories, and move or delete files and directories. In addition to simply listing directories, you may obtain an NSDirectoryEnumerator instance for recursive directory contents enumeration.
Returns a shared default file manager which may be used throughout an application.
Changes the current directory used for all
subsequent operations.
All non-absolute
paths are interpreted relative to this directory.
The current directory is set on a per-task
basis, so the current directory for other file
manager instances will also be changed by this
method.
Change the attributes of the file at
path to those specified.
Returns
YES
if all requested changes were made
(or if the dictionary was nil
or empty, so
no changes were requested), NO
otherwise.
On failure, some fo the requested changes may
have taken place.
Returns an array of path components suitably modified for display to the end user. This modification may render the returned strings unusable for path manipulation, so you should work with two arrays... one returned by this method (for display tio the user), and a parallel one returned by [NSString -pathComponents] (for path manipulation).
Reads the file at path an returns its
contents as an NSData object.
If an error
occurs or if path specifies a directory
etc then nil
is returned.
Returns YES
if the contents of the
file or directory at path1 are the same as
those at path2.
If path1
and path2 are files, this is a simple
comparison. If they are directories, the
contents of the files in those subdirectories are
compared recursively.
Symbolic links are
not followed.
A comparison checks first file
identity, then size, then content.
Copies the file or directory at source to
destination, using a handler
object which should respond to
[NSObject -fileManager:willProcessPath:]
and [NSObject -fileManager:shouldProceedAfterError:]
messages.
Will not copy to a destination which already exists.
Creates a new directory, and sets its
attributes as specified.
Creates
other directories in the path as
necessary.
Returns YES
on
success, NO
on failure.
Creates a new file, and sets its
attributes as specified.
Initialises the file content with the specified
data.
Returns YES
on success,
NO
on failure.
Creates a symbolic link at path which links to the location specified by otherPath.
Returns the current working directory used by all instance of the file manager in the current task.
Returns an array of the contents of the specified
directory.
The listing does
not recursively list
subdirectories.
The special files
'.' and '..' are not listed.
Indicates an error
by returning nil
(eg. if path is
not a directory or it can't be read for some reason).
Returns the name of the file or directory at
path. Converts it into a format for
display to an end user. This may render it unusable
as part of a file/path name.
For instance, if a
user has elected not to see file extensions, this
method may return filenames with the extension
removed.
The default operation is to return
the result of calling
[NSString -lastPathComponent]
on the path.
Returns an enumerator which can be used to return
each item with the directory at path in
turn.
The enumeration is recursive...
following all nested subdirectories.
If a file (or directory etc) exists at the specified
path, and can be queried for its
attributes, this method returns a dictionary
containing the various attributes of that file.
Otherwise nil
is returned.
If
the flag is NO
and the file is
a symbolic link, the attributes of the link itself
(rather than the file it points to) are returned.
The dictionary keys for attributes are -
NSFileAppendOnly
NSFileCreationDate
NSFileDeviceIdentifier
NSFileExtensionHidden
NSFileGroupOwnerAccountName
NSFileGroupOwnerAccountID
NSFileHFSCreatorCode
NSFileHFSTypeCode
NSFileImmutable
NSFileModificationDate
NSFileOwnerAccountName
NSFileOwnerAccountID
NSFilePosixPermissions
NSFileReferenceCount
NSFileSize
NSFileSystemFileNumber
NSFileSystemNumber
NSFileType
The NSDictionary class also has a set of convenience accessor methods which enable you to get at file attribute information more efficiently than using the keys above to extract it. You should generally use the accessor methods where they are available.
Returns YES
if a file (or directory
etc) exists at the specified path.
Returns YES
if a file (or directory
etc) exists at the specified path.
If the isDirectory argument is not a nul
pointer, stores a flag in the location it points
to, indicating whether the file is a directory or not.
Returns a dictionary containing the filesystem
attributes for the specified path (or
nil
if the path is not
valid).
NSFileSystemSize
NSFileSystemFreeSize
NSFileSystemNodes
NSFileSystemFreeNodes
NSFileSystemNumber
Convert from OpenStep internal path
format (Unix-style) to a string in the local
filesystem format, suitable for passing to
system functions.
Under Unix, this simply
standardizes the path and converts
to a C string.
Under Windoze, this attempts to
use local conventions to convert to a windows
path. In GNUstep, the conventional unix
syntax '~user/...' can be used to indicate a windoze
drive specification by using the drive letter in
place of the username, and the syntax '~@server/...'
can be used to indicate a file located on the named
windoze network server (the '~@' maps to the
leading '//' in a windoze UNC path
specification.
Returns YES
if a file (or directory
etc) exists at the specified path and is
deletable.
Returns YES
if a file (or directory
etc) exists at the specified path and is
executable (if a directory is executable, you
can access its contents).
Returns YES
if a file (or directory
etc) exists at the specified path and is
readable.
Returns YES
if a file (or directory
etc) exists at the specified path and is
writable.
Links the file or directory at source to destination, using a handler object which should respond to [NSObject -fileManager:willProcessPath:] and [NSObject -fileManager:shouldProceedAfterError:] messages.
If the destination is a directory, the source path is linked into that directory, otherwise the destination must not exist, but its parent directory must exist and the source will be linked into the parent as the name specified by the destination.
If the source is a symbolic link, it is
copied to the destination.
If
the source is a directory, it is copied to
the destination and its contents are
linked into the new directory.
Otherwise, a
hard link is made from the destination to
the source.
Convert from OpenStep internal path format (Unix-style) to a NSString in the local filesystem format. Under Windoze, this attempts to use local conventions to convert to a windows path. In GNUstep, the conventional unix syntax '~user/...' can be used to indicate a windoze drive specification by using the drive letter in place of the username, and the syntax '~@server/...' can be used to indicate a file located on the named windoze network server (the '~@' maps to the leading '//' in a windoze UNC path specification.
Moves the file or directory at source to
destination, using a handler
object which should respond to
[NSObject -fileManager:willProcessPath:]
and [NSObject -fileManager:shouldProceedAfterError:]
messages. Will not move to a destination which already exists.
This method converts from a local system specific
filename representation to the internal OpenStep
representation (unix-style). This should be
used whenever a filename is read in from the local
system.
In GNUstep, windoze drive specifiers
are encoded in the internal path using the
conventuional unix syntax of '~user/...'
where the drive letter is used instead of a username.
Returns the name of the file or directory that the symbolic link at path points to.
Removes the file or directory at path, using a handler object which should respond to [NSObject -fileManager:willProcessPath:] and [NSObject -fileManager:shouldProceedAfterError:] messages.
This method converts from a local system specific
filename representation to the internal OpenStep
representation (unix-style). This should be
used whenever a filename is read in from the local
system.
In GNUstep, windoze drive specifiers
are encoded in the internal path using the
conventuional unix syntax of '~user/...'
where the drive letter is used instead of a username.
Returns an array containing the (relative) paths of
all the items in the directory at path.
The listing follows all subdirectories, so it
can produce a very large array... use with care.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
- Declared in:
- Foundation/NSFileManager.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Convenience methods for accessing named file attributes in a dictionary.
Method summary
Return the file creation date attribute (or
nil
if not found).
Return the file extension hidden attribute (or
NO
if not found).
Return the numeric value of the NSFileGroupOwnerAccountID attribute in the dictionary, or NSNotFound if the attribute is not present.
Return the file group owner account name attribute
or nil
if not present.
Returns HFS creator attribute (OS X).
Returns HFS type code attribute (OS X).
Return the file append only attribute (or
NO
if not found).
Return the file immutable attribute (or
NO
if not found).
Return the file modification date attribute (or
nil
if not found)
Return the numeric value of the NSFileOwnerAccountID attribute in the dictionary, or NSNotFound if the attribute is not present.
Return the file owner account name attribute or
nil
if not present.
Return the file posix permissions attribute (or NSNotFound if the attribute is not present in the dictionary).
Return the size of the file, or NSNotFound if the file size attribute is not found in the dictionary.
Return the file system file identification number attribute or NSNotFound if the attribute is not present in the dictionary).
Return the file system number attribute (or NSNotFound if the attribute is not present in the dictionary).
Return the file type attribute or nil
if not present.
- Declared in:
- Foundation/NSFileManager.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
An informal protocol to which handler objects should conform if they wish to deal with copy and move operations performed by NSFileManager.
Method summary
When an error occurs during a copy or move
operation, the file manager will send this
message to the handler, and will use the return
value to determine whether the operation should
proceed. If the method returns YES
then the operation will proceed after the error, if
it returns NO
then it will be aborted.
If the handler does not implement this method it will
be treated as if it returns NO
.
The error dictionary contains the following
Note that the FromPath
is a GNUstep
extension.
Also the FromPath
and
ToPath
are filled in when
appropriate. So when copying a file they
will typically both have a value and when reading
only FromPath
.
The file manager sends this method to the handler immediately before performing part of a directory move or copy operation. This provides the handler object with information it can use in the event of an error, to decide whether processing should proceed after the error.