Dir Class Reference

The Dir JavaScript class. Interface to operating system Dir operations, e.g. mkdir, rmdir, rename, etc. More...

Public Slots

String filePath (String &file=String::null)
 Get file path for the current directory from the file parameter. More...
 
String absFilePath (String &file=String::null)
 Get absolute file path for filename given in parameter. More...
 
void cd (String &dirName)
 Changes the current directory to the given directory name. More...
 
void cdUp ()
 Go up in directory hierarchy. More...
 
StringList entryList (String &filter, int filterSpec=-1, int sortSpec=-1)
 Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters. More...
 
void mkdir (String &dirName=String::null)
 Create a directory with given name. More...
 
void rmdir (String &dirName=String::null)
 Remove a directory with given name. More...
 
void mkdirs (String &dirName=String::null)
 Create directory recursively if a path of a directory not yet created is given. More...
 
void rmdirs (String &dirName=String::null)
 Remove directory recursively if a path of directory is given. More...
 
void remove (String &fileName)
 Remove a file with the given name. More...
 
void rename (String &oldName, String &newName)
 Rename a file/folder with the name given to the new name. More...
 
bool fileExists (String &fileName)
 Check if the file/folder exist. More...
 
void setCurrent ()
 Sets the application's current working directory to path. More...
 

Public Member Functions

 Dir (String &path)
 Construct a Dir from a directory path. More...
 

Properties

String name
 Returns the name of the directory. More...
 
String path
 Returns the path of the directory. More...
 
String absPath
 Returns the absolute path of the directory. More...
 
String canonicalPath
 Returns the canonical path of the directory. More...
 
bool readable
 Returns true if the directory is readable. More...
 
bool exists
 Returns true if the directory exists. More...
 

Detailed Description

The Dir JavaScript class. Interface to operating system Dir operations, e.g. mkdir, rmdir, rename, etc.

var dir = new Dir;
dir.path = this._exportDir;
dir.mkdirs();

Constructor & Destructor Documentation

◆ Dir()

Dir::Dir ( String &  path)
inline

Construct a Dir from a directory path.

Parameters
pathThe path of a directory.

Member Function Documentation

◆ absFilePath

String Dir::absFilePath ( String &  file = String::null)
slot

Get absolute file path for filename given in parameter.

Parameters
file: The filename to get the absolute path of.
Returns
Returns the absolute file path for the given filename.

◆ cd

void Dir::cd ( String &  dirName)
slot

Changes the current directory to the given directory name.

Parameters
dirName: The desired directory name.

◆ cdUp

void Dir::cdUp ( )
slot

Go up in directory hierarchy.

◆ entryList

StringList Dir::entryList ( String &  filter,
int  filterSpec = -1,
int  sortSpec = -1 
)
slot

Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters.

Parameters
filter: The filter to apply to the directories and files.
filterSpec: The filter flags.
sortSpec: The sort flags.

◆ fileExists

bool Dir::fileExists ( String &  fileName)
inlineslot

Check if the file/folder exist.

Parameters
fileName: The name of the file/folder.
Returns
Returns true if the file/folder exists.

◆ filePath

String Dir::filePath ( String &  file = String::null)
slot

Get file path for the current directory from the file parameter.

Parameters
file: The filename to get the path of.
Returns
The file path for the current directory from the filename.

◆ mkdir

void Dir::mkdir ( String &  dirName = String::null)
slot

Create a directory with given name.

Parameters
dirName: The name of the directory to be created.

◆ mkdirs

void Dir::mkdirs ( String &  dirName = String::null)
slot

Create directory recursively if a path of a directory not yet created is given.

Parameters
dirName: The name of the directory to be created.

◆ remove

void Dir::remove ( String &  fileName)
slot

Remove a file with the given name.

Parameters
fileName: The name of the file to be removed.

◆ rename

void Dir::rename ( String &  oldName,
String &  newName 
)
slot

Rename a file/folder with the name given to the new name.

Parameters
oldName: The current name of the file.
newName: The desired name for the file.

◆ rmdir

void Dir::rmdir ( String &  dirName = String::null)
slot

Remove a directory with given name.

Parameters
dirName: The name of the directory to be removed.

◆ rmdirs

void Dir::rmdirs ( String &  dirName = String::null)
slot

Remove directory recursively if a path of directory is given.

Parameters
dirName: The name of the directory to be removed.

◆ setCurrent

void Dir::setCurrent ( )
slot

Sets the application's current working directory to path.

Property Documentation

◆ absPath

String Dir::absPath
read

Returns the absolute path of the directory.

Returns
The absolute path of the directory.

◆ canonicalPath

String Dir::canonicalPath
read

Returns the canonical path of the directory.

Returns
The canonical path of the directory.

◆ exists

bool Dir::exists
read

Returns true if the directory exists.

Returns
True if the directory exists.

◆ name

String Dir::name
read

Returns the name of the directory.

Returns
The name of the directory.

◆ path

String Dir::path
readwrite

Returns the path of the directory.

Returns
The path of the directory.

◆ readable

bool Dir::readable
read

Returns true if the directory is readable.

Returns
True if the directory is readable.