### IDirectory

  This class provides a surrogate object for a file system directory.

  Do not derive your own classes from this class.

### IDirectory - Member Functions and Data by Group

### Constructors & Destructor

Use the functions in this group to construct and destroy IDirectory objects.

~IDirectory

      public:
      virtual ~IDirectory()

  Destroys the IDirectory object.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IDirectory
  Constructs an IDirectory object.

  Overload 1
  Copy constructor.

      public:
      IDirectory(const IDirectory& copy)

  Use the copy constructor to create a directory object copied from the given one.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Default constructor.

      public:
      IDirectory()

  Use the default constructor to create an empty directory object.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Assignment Operator

The assignment operator for this class.

operator =

      public:
      IDirectory& operator =(const IFileSystemEntity& right)

  The assignment operator for this class.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Browsing and Managing the File System

Use the functions in this group to browse and manage the file system, for example, to create a new directory or file, delete the contents of a directory, create a temporary directory, and so forth.

createDirectory

      public:
      IDirectory
        createDirectory( const IFileName& pathOrName,
                         const ICompoundNameParser& = defaultParser ( ) )

  Creates a new directory in the specified location relative to this directory.

  pathOrName
    The host-specific path name of the directory to be created. This can be a single "leaf" name of a directory to be created in this directory, or it can be a partial path relative to this directory.

  ICompoundNameParser
    The parser used with the name of the new directory. If none is specified, the system's default parser is used.

Exception

  IInvalidParameter | thrown if pathOrName is a full path instead of a partial path

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

createFile

      public:
      IFile
        createFile( const IFileName& name,
                    IFileSize initialSize = 0,
                    const ICompoundNameParser& = defaultParser ( ) )

  Creates a new file in the specified location relative to this directory.

  name
    The host-specific path name of the file to be created. This can be a single "leaf" name of a file to be created in this directory, or it can be a partial path relative to this directory.

  ICompoundNameParser
    The parser used with the name of the new file. If none is specified, the system's default parser is used.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

createTemporary
  Creates a temporary directory.

      public:
      static IDirectory
        createTemporary( const IFileName& dirName = uniqueName ( ) )

  Creates a temporary directory in the appropriate place for temporary storage on the current system. The directory is temporary in that it is not automatically deleted when the IDirectory object is destroyed.

  dirName
    The name for the temporary directory. If none is provided, a unique name is generated.

Exception

  IEntityExists | thrown if a name is provided and a a temporary directory with that name already exists.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

deleteAllContents

      public:
      void deleteAllContents()

  Deletes all entities within this directory. This includes the contents of any subdirectories.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

getRecord

      public:
      IFSDirectoryRecord* getRecord() const

  Returns the file system record.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

lookUp

  Overload 1
  Finds the entity specified by a portable path relative to this directory.

      public:
      IFileSystemEntity
        lookUp( const IPathName& partialPath ) const

  Use this function to find by a portable path relative to this directory.

  partialPath
    The portable path name of the entity to be looked up. This can be a single component path containing the "leaf" name of an entity in this directory, or it can be a partial path relative to this directory.

Exception

  IInvalidParameter | thrown if partialPath is a full path instead of a partial path

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Finds the entity specified by a host-specific path relative to this directory.

      public:
      IFileSystemEntity
        lookUp( const IHostPathName& pathOrName,
                const ICompoundNameParser& = defaultParser ( ) ) const

  Use this function to find the entity specified by a host-specific path relative to this directory.

  pathOrName
    The host-specific path name of the entity to be looked up. This can be a single "leaf" name of an entity in this directory, or it can be a partial path relative to this directory.

  ICompoundNameParser
    The parser used with the name of the new directory. If none is specified, the system's default parser is used.

Exception

  IInvalidParameter | thrown if pathOrName is a full path instead of a partial path

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Class Constants

Constants for use with this class.

kKind

      public:
      static const IFileKind _IMPORT kKind

  The kind of the file system entity. A homegrown type of RTTI for the filesystem.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Getting and Setting the Processes Current Directory

Use the functions in this group to set or get the current directory for the process.

current

      public:
      static IDirectory current()

  Returns the current directory for this process. File system operations using partial path names are evaluated relative to the current directory.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setCurrent

      public:
      static void setCurrent(const IDirectory&)

  Sets the current directory for this process. Subsequent file system operations using partial path names are evaluated relative to the current directory.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Special "Downcast" Construction

Use the constructors in this group to create IDirectory objects based on the given information, such as a host path name, a partial path name, a file system entity, or a file system directory record.

IDirectory
  Constructs an IDirectory object.

  Overload 1
  Constructs a directory object from a file system directory record.

      public:
      IDirectory(IFSDirectoryRecord* Record)

  Use this constructor to create a directory object from the given file system directory record.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Constucts an IDirectory from a host-specific path name.

      public:
      IDirectory( const IHostPathName& path,
                  ECreateFlags flags = kMustExist,
                  const ICompoundNameParser& = defaultParser ( ) )

  Use this constructor to create a directory object from a host-specific path name.

  path
    Text string containing the host-specific path name.

  parser
    The path name parser which should be used to parse the provided path. If no parser is specified, the default for the current system is used.

  flags
    Specifies whether the constructor creates or overwrites a directory on the disk.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 3
  Constructs an IDirectory from an entity object, with type checking.

      public:
      IDirectory(const IFileSystemEntity& copy)

  Use this copy constructor to create a directory object from the given file system entity.

  copy
    If this entity refers to a physical directory, the constructed IDirectory refers to the same object. If it is not a directory, an exception is thrown.

Exception

  IEntityTypeMismatch | thrown if the specified entity is not a directory

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 4
  Constucts an IDirectory from a portable path name.

      public:
      IDirectory( const IPathName& path,
                  ECreateFlags flags = kMustExist )

  Use this constructor to create a directory object from the given portable path name.

  path
    The portable path name.

  flags
    Specifies whether the constructor creates or overwrites a directory on the disk.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IDirectory - Inherited Member Functions and Data

#### Inherited Public Functions

  IFileSystemEntity

  -     virtual ~IFileSystemEntity()

  -     bool connected() const

  -     IFileSystemEntity
          copyTo( IDirectory& destination,
                  const IFileName& newName = "",
                  EFailureAction action = kStop ) const

  -     static const ICompoundNameParser& defaultParser()

  -     void deleteSelf(bool deleteChildren = false)

  -     IFSRecord* getRecord() const

  -     IHostPathName
          hostPath( const ICompoundNameParser& parser = defaultParser ( ) ) const

  -     IFileSystemEntity(IFSRecord* Record)

  -     IFileSystemEntity(const IPathName& path)

  -     IFileSystemEntity( const IHostPathName& hostPath,
                           const ICompoundNameParser& = defaultParser ( ) )

  -     IFileSystemEntity(const IFileSystemEntity& copy)

  -     IFileSystemEntity()

  -     bool isA(const IFileKind& kind) const

  -     ITimeStamp modificationTime() const

  -     void
          moveTo( IDirectory& destination,
                  const IFileName& newName = "",
                  EFailureAction action = kStop )

  -     IFileName name() const

  -     bool operator !=(const IFileSystemEntity& object) const

  -     virtual IFileSystemEntity&
          operator =( const IFileSystemEntity& right )

  -     bool operator ==(const IFileSystemEntity& object) const

  -     IDirectory parent() const

  -     IPathName path() const

  -     virtual void readFromStream(IDataStream& fromwhere)

  -     void setName(const IFileName& newName) const

  -     bool temporary() const

  -     IDirectory topmostParent() const

  -     static const IFileName& uniqueName()

  -     bool valid() const

  -     IVolume volume() const

  -     virtual void writeToStream(IDataStream& towhere) const

  IMStreamable

  -     virtual ~IMStreamable()

  -     void externalizeToStream(IDataStream& towhere) const

  -     void internalizeFromStream(IDataStream& fromwhere)

  -     virtual const ITypeRepresentation&
          typeRepresentation() const = 0

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  IMStreamable

  -     IMStreamable(const IMStreamable& other)

  -     IMStreamable()

  -     virtual void readFromStream(IDataStream& fromwhere) = 0

  -     virtual void writeToStream(IDataStream& towhere) const = 0

  IFileSystemEntity

  -     void setInvalid()

  -     void
          typeSafeAssign( const IFileSystemEntity& right,
                          const IFileKind& kind )

#### Inherited Protected Data

  - None