31 #ifndef PTLIB_DIRECTORY_H
32 #define PTLIB_DIRECTORY_H
46 #define PDIR_SEPARATOR '\\'
47 #define PPATH_SEPARATOR ';' // As used in PATH environment variable
51 #define PDIR_SEPARATOR '/'
52 #define PPATH_SEPARATOR ':' // As used in PATH environment variable
53 #define P_MAX_PATH (_POSIX_PATH_MAX)
90 DefaultSearch = RegularFile | SymbolicLink | SubDirectory
129 AllPermissions = 0x1ff,
130 DefaultPerms = UserRead|UserWrite|GroupRead|WorldRead,
131 DefaultDirPerms = DefaultPerms|UserExecute|GroupExecute|WorldExecute
188 const char * cpathname
208 const char * cpathname
322 int perm = PFileInfo::DefaultDirPerms,
332 int perm = PFileInfo::DefaultDirPerms,
374 PFileInfo::FileTypes scanMask = PFileInfo::DefaultSearch
392 PFileInfo::FileTypes scanMask = PFileInfo::DefaultSearch
409 virtual void Close();
467 Sorting sortBy = Unsorted
488 #include "msos/ptlib/pdirect.h"
490 #include "unix/ptlib/pdirect.h"
496 #endif // PTLIB_DIRECTORY_H
virtual bool Restart(PFileInfo::FileTypes scanMask=PFileInfo::DefaultSearch)
Restart file list scan from the beginning of directory.
FileTypes type
File type for this file. Only one bit is set at a time here.
Definition: pdirect.h:94
virtual void Close()
Close the directory during or after a file list scan.
void Destruct()
Internal function called from container destructors.
std::vector< Entry > Entries
Definition: pdirect.h:450
PDirectory & operator=(const PString &pathname)
Set the directory to the specified path.
bool GetVolumeSpace(PInt64 &total, PInt64 &free, DWORD &clusterSize) const
Determine the total number of bytes and number of bytes free on the volume that this directory is con...
bool Exists() const
Test for if the directory exists.
This class defines an absolute time and date.
Definition: ptime.h:49
bool Create(int perm=PFileInfo::DefaultDirPerms, bool recurse=false) const
Create a new directory with the specified permissions.
bool IsRoot() const
Determine if the directory is the root directory of a volume.
PTime accessed
Time of last access to the file.
Definition: pdirect.h:107
#define PINLINE
Definition: object.h:194
PString m_name
Definition: pdirect.h:448
virtual PFilePathString GetEntryName() const
Get the name (without the volume or directory path) of the current entry in the directory scan...
void Destruct()
Definition: pdirect.h:479
This class is a variation of a string that ignores case.
Definition: pstring.h:2012
static PINLINE bool IsSeparator(char ch)
Determine if the character ch is a directory path separator.
This is an array collection class of PString objects.
Definition: pstring.h:2365
P_DECLARE_BITWISE_ENUM_EX(FileTypes, 10,(NoFileType, RegularFile, SymbolicLink, SubDirectory, ParentDirectory, CurrentDirectory, CharDevice, BlockDevice, Fifo, SocketDevice, UnknownFileType), AllFiles=0x3ff, DefaultSearch=RegularFile|SymbolicLink|SubDirectory)
All types that a particular file path may be.
PDirectory GetParent() const
Get the directory for the parent to the current directory.
#define P_MAX_PATH
Definition: pdirect.h:53
bool hidden
File is a hidden file.
Definition: pdirect.h:145
bool Change() const
Change the current working directory to the objects location.
Class to represent a directory in the operating system file system.
Definition: pdirect.h:173
P_DECLARE_ENUM(Sorting, Unsorted, SortByType, SortByName, SortBySize, SortByCreated, SortByModified, SortByAccessed, SortByPermission)
PTime modified
Time of last modifiaction of the file.
Definition: pdirect.h:102
#define free(p)
Override of system call for memory check system.
Definition: object.h:1870
PTime created
Time of file creation of the file.
Definition: pdirect.h:99
PString PFilePathString
Definition: pdirect.h:54
virtual bool IsSubDir() const
Determine if the directory entry currently being scanned is itself another directory entry...
PFileInfo::FileTypes m_scanMask
Mask of file types that the directory scan will return.
Definition: pdirect.h:484
The character string class.
Definition: pstring.h:108
PDirectory GetRoot() const
Get the root directory of a volume.
Base string type for a file path.
Definition: filepath.h:44
virtual bool GetInfo(PFileInfo &info) const
Get file information on the current directory entry.
static PDirectory GetTemporary()
Get the OS temporary directory.
Permissions permissions
A bit mask of all the file acces permissions.
Definition: pdirect.h:139
PUInt64 size
Size of the file in bytes.
Definition: pdirect.h:112
virtual bool Next()
Move to the next file in the directory scan.
PStringArray GetPath() const
Get the directory path as an array of strings.
virtual bool Open(PFileInfo::FileTypes scanMask=PFileInfo::DefaultSearch)
Open the directory for scanning its list of files.
Definition: pdirect.h:447
PDirectory()
Create a directory object of the current working directory.
bool Remove()
Delete the directory.
Class containing the system information on a file path.
Definition: pdirect.h:65
PFilePathString GetVolume() const
Get the volume name that the directory is in.
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
bool GetEntries(Entries &entries, Sorting sortBy=Unsorted)
Get all the entries in this directory.