The Dir JavaScript class. Interface to operating system Dir operations, e.g. mkdir
, rmdir
, rename
, etc.
More...
|
String | filePath (String &file=String()) |
| Get file path for the current directory from the file parameter. More...
|
|
String | absFilePath (String &file=String()) |
| 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 filterType=-1, int sortFlags=-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()) |
| Create a directory with given name. More...
|
|
void | rmdir (String &dirName=String()) |
| Remove a directory with given name. More...
|
|
void | mkdirs (String &dirName=String()) |
| Create directory recursively if a path of a directory not yet created is given. More...
|
|
void | rmdirs (String &dirName=String()) |
| 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...
|
|
The Dir JavaScript class. Interface to operating system Dir operations, e.g. mkdir
, rmdir
, rename
, etc.
dir.path = this._exportDir;
dir.mkdirs();
◆ Dir()
Dir::Dir |
( |
String & |
path | ) |
|
|
inline |
Construct a Dir from a directory path.
- Parameters
-
path | The path of a directory. |
◆ absFilePath
String Dir::absFilePath |
( |
String & |
file = String() | ) |
|
|
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
Go up in directory hierarchy.
◆ entryList
StringList Dir::entryList |
( |
String & |
filter, |
|
|
int |
filterType = -1 , |
|
|
int |
sortFlags = -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.
dir.path = "c:/myscriptpath/";
var scriptsFiles = dir.entryList("*.js");
- Parameters
-
filter | : The filter to apply to the directories and files. Ex: "*.js" or "*" for all the content. |
filterType | : (optional) The QDir (see Qt's QDir::Filters documentation) filter type. -1 by default |
sortFlags | : (optional) The QDir (see Qt's QDir::SortFlags documentation) sort flags. -1 by default |
◆ 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() | ) |
|
|
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() | ) |
|
|
slot |
Create a directory with given name.
- Parameters
-
dirName | : The name of the directory to be created. |
◆ mkdirs
void Dir::mkdirs |
( |
String & |
dirName = String() | ) |
|
|
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() | ) |
|
|
slot |
Remove a directory with given name.
- Parameters
-
dirName | : The name of the directory to be removed. |
◆ rmdirs
void Dir::rmdirs |
( |
String & |
dirName = String() | ) |
|
|
slot |
Remove directory recursively if a path of directory is given.
- Parameters
-
dirName | : The name of the directory to be removed. |
◆ setCurrent
Sets the application's current working directory to path.
◆ absPath
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
Returns true if the directory exists.
- Returns
- True if the directory exists.
◆ name
Returns the name of the directory.
- Returns
- The name of the directory.
◆ path
Returns the path of the directory.
- Returns
- The path of the directory.
◆ readable
Returns true if the directory is readable.
- Returns
- True if the directory is readable.