mircea@jupiter.elcom.pub.ro
)ovidiu@net-community.com
)n.pero@mi.flashnet.it
)rfm@gnu.org
)Copyright: (C) 1997,1999-2005 Free Software Foundation, Inc.
The rules for path handling depend on the value in the
GNUSTEP_PATH_HANDLING
environment
variable and, to some extent, on the platform on
which the program is running.
The understood
values of GNUSTEP_PATH_HANDLING are unix and
windows. If GNUSTEP_PATH_HANDLING is any other
value (or has not been set), GNUstep interprets this as
meaning it should try to do-the-right-thing
In the default mode of operation the system is
very tolerant of paths and allows you to work with both
unix and windows style paths. The consequences of this
are apparent in the path handling methods of
NSString
rather than in
NSFileManager
.
On all Unix platforms, Path components are separated
by slashes and file names may contain any character
other than slash.
The file names. and..
are special cases meaning current directory and the
parent of the current directory respectively.
Multiple adjacent slash characters are
treated as a single separator.
On Microsoft Windows the native paths may be either
UNC or drive-relative, so GNUstep supports both.
Either or both slash (/) and backslash
(\) may be used as separators for path components
in either type of name.
UNC paths follow the
general form //host/share/path/file, but must
at least contain the host and share parts, i.e.
//host/share is a UNC path, but //host is
not
Drive-relative names consist
of an optional drive specifier (consisting of a
single letter followed by a single colon)
followed by an absolute or relative path.
In both forms, the names. and.. are refer
to the current directory and the parent directory as
in unix paths.
In the default mode, GNUstep handles both unix and
windows paths so it treats both slash (/) and
backslash (\) as separators and understands
the windows UNC and drive relative path roots.
However, it treats any path beginning
with a slash (/) as an absolute path
if running on a unix system.
Attempting to pass absolute paths between
applications working on different systems
is fraught with difficulty... just don't do it.
Where paths need to be passed around (eg.
in property lists or archives) you should pass
relative paths and use a standard mechanism to
construct an absolute path in the receiving
application, for instance, appending the
relative path to the home directory of a user.
GNUstep handles substitution of tilde (~) as
follows:
If a path is just ~ or begins
~/ then the value returned by
NSHomeDirectory()
is substituted for the tilde.
If a path is of
the form ~name or begins with a string like ~name/
then name is used as the argument to
NSHomeDirectoryForUser()
and the return value from that method (if non-nil)
is used to replace the tilde.
- Declared in:
- Foundation/NSFileManager.h
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:]
.
This implementation is optimized and performance should be comparable to the speed of standard Unix tools for large directories.
The order in which directory contents are enumerated is undefined, and in the current implementation the natural order of the underlying filesystem is used.
- Declared in:
- Foundation/NSFileManager.h
nil
is 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.
YES
if all requested changes were made
(or if the dictionary was nil
or empty, so
no changes were requested), NO
otherwise.
nil
is returned.
YES
if the contents of the
file or directory at path1 are the same as
those at path2. nil
(eg.
if path is not a directory or it can't be
read for some reason).