Class to represent a directory in the operating system file system.
![]() | Construction |
![]() | Access functions |
![]() | File system functions |
![]() | Directory listing functions |
![]() | scanMask Mask of file types that the directory scan will return. |
Overrides from class PObject
Overrides from class PContainer
Size/Length functions
Concatenation operators *
Comparison operators
Search & replace functions
Sub-string functions
Conversion functions
New functions for class
Common functions for containers
Run Time Type functions
Comparison functions
I/O functions
Miscellaneous functions
Class to represent a directory in the operating system file system. A directory is a special file that contains a list of file paths.The directory paths are highly platform dependent and a minimum number of assumptions should be made.
The PDirectory object is a string consisting of a possible volume name, and a series directory names in the path from the volumes root to the directory that the object represents. Each directory is separated by the platform dependent separator character which is defined by the PDIR_SEPARATOR macro. The path always has a trailing separator.
Some platforms allow more than one character to act as a directory separator so when doing any processing the IsSeparator() function should be used to determine if a character is a possible separator.
The directory may be opened to gain access to the list of files that it contains. Note that the directory does not contain the "." and ".." entries that some platforms support.
The ancestor class is dependent on the platform. For file systems that are case sensitive, eg Unix, the ancestor is PString. For other platforms, the ancestor class is PCaselessString.
PDirectory( const char * cpathname )
PDirectory( const PString & pathname )
PDirectory& operator=( const PString & pathname )
PDirectory& operator=( const char * cpathname )
This is platform dependent, for example for MS-DOS it is the 11
character volume name for the drive, eg "DOS_DISK", and for Macintosh it
is the disks volume name eg Üntitled". For a unix platform it is the
device name for the file system eg "/dev/sda1".
Note that the free space will be the physical limit and if user quotas
are in force by the operating system, the use may not actually be able
to use all of these bytes.
PFilePathString GetVolume() const
BOOL IsRoot() const
static PINLINE BOOL IsSeparator( char ch )
BOOL GetVolumeSpace( PInt64 & total, PInt64 & free, DWORD & clusterSize ) const
free - Number of bytes unused on the volume
clusterSize - "Quantisation factor" in bytes for files on volume
static BOOL Exists( const PString & path )
BOOL Change() const
static BOOL Change( const PString & path )
BOOL Create( int perm = PFileInfo::DefaultDirPerms ) const
static BOOL Create( const PString & p, int perm = PFileInfo::DefaultDirPerms )
perm - Permission on new directory.BOOL Remove()
static PINLINE BOOL Remove( const PString & path )
Only files that are of a type that is specified in the mask will be returned.
Note that the directory scan will not return the "." and ".." entries that some platforms support.
Only files that are of a type that is specified in the mask will be
returned. Note that the directory scan will not return the "." and ".."
entries that some platforms support.
Only files that are of a type that is specified in the mask passed to
the Open() or Restart() functions will be returned. Note that the directory scan will not return the "." and ".."
entries that some platforms support.
To get a full path name concatenate the PDirectory object itself with
the entry name. Note that the directory scan will not return the "." and ".."
entries that some platforms support.
Note that the directory scan will not return the "." and ".."
entries that some platforms support.
BOOL Restart( int scanMask = PFileInfo::AllFiles )
BOOL Next()
void Close()
PFilePathString GetEntryName() const
BOOL IsSubDir() const
BOOL GetInfo( PFileInfo & info ) const
Alphabetic index HTML hierarchy of classes or Java