Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXDir Class Reference

Directory enumerator. More...

#include <FXDir.h>

Public Types

enum  {
  MatchAll = 0, NoFiles = 1, NoDirs = 2, AllFiles = 4,
  AllDirs = 8, HiddenFiles = 16, HiddenDirs = 32, NoParent = 64,
  CaseFold = 128
}
 Options for listing files. More...
 

Public Member Functions

 FXDir ()
 Construct directory enumerator.
 
 FXDir (const FXString &path)
 Construct directory enumerator open on path.
 
FXbool open (const FXString &path)
 Open directory to path, return true if ok.
 
FXbool isOpen () const
 Returns true if the directory is open.
 
FXbool next (FXString &name)
 Go to next directory entry and return its name.
 
void close ()
 Close directory.
 
 ~FXDir ()
 Destructor.
 

Static Public Member Functions

static FXbool create (const FXString &path, FXuint perm=FXIO::AllFull)
 Create directory.
 
static FXbool remove (const FXString &path)
 Remove directory.
 
static FXint listFiles (FXString *&filelist, const FXString &path, const FXString &pattern="*", FXuint flags=FXDir::MatchAll)
 List files in a given directory. More...
 
static FXint listDrives (FXString *&drivelist)
 List drives, i.e. More...
 
static FXbool createDirectories (const FXString &path, FXuint perm=FXIO::AllFull)
 Create a directories recursively.
 

Detailed Description

Directory enumerator.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Options for listing files.

Enumerator
NoFiles 

Only files and directories matching pattern.

NoDirs 

Don't list any files.

AllFiles 

Don't list any directories.

AllDirs 

List all files.

HiddenFiles 

List all directories.

HiddenDirs 

List hidden files also.

NoParent 

List hidden directories also.

CaseFold 

Don't include '.' and '..' in the listing.

Member Function Documentation

◆ listDrives()

static FXint FX::FXDir::listDrives ( FXString *&  drivelist)
static

List drives, i.e.

the roots of directory trees. On Windows, this returns an array of strings like {"C:\", "D:\", ..., ""}, while on Unix it will be just a two-element list like {"/", ""}. The last element will be always be set to the empty string. The list can be released by means of delete [] list. Returns the number of non-empty elements in the array.

◆ listFiles()

static FXint FX::FXDir::listFiles ( FXString *&  filelist,
const FXString path,
const FXString pattern = "*",
FXuint  flags = FXDir::MatchAll 
)
static

List files in a given directory.

Returns the number of files in the string-array list which matched the pattern or satisfied the flag conditions.


The documentation for this class was generated from the following file:

Copyright © 1997-2022 Jeroen van der Zijp