factory file
- Description:
Specifies the file system specific functions.
- These functions are accessible via the
aidesys::prefix.
- These functions are accessible via the
Methods
(static) readDir(path, patternopt) → {Array.<string>}
- Description:
Lists all files of a directory.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
path |
string | The directory to list. |
||
pattern |
string |
<optional> |
".*"
|
The file pattern regular expression using the ECMAScript syntax. |
Returns:
A std::vector<std::string> structure with the file names.
- The file base names with file extension and without the directory path are provided.
- Type
- Array.<string>
(static) getFileTime(filename)
- Description:
Gets the file last modificaton time, in milliseconds.
Parameters:
| Name | Type | Description |
|---|---|---|
filename |
string | The file path name. |
Returns:
The file last modificaton time, in milliseconds, since January 1, 1970, midnight, UTC/GMT (i.e., Greewitch time).
- Returns NAN, if the file does not exists:
- So:
std::isnan(aidesys::getFileTime(file))is equivalent toaidesys::exists(file).
- So:
(static) path(filename, whatopt)
- Description:
Returns a filename path element.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
filename |
string | The file path name. |
||
what |
char |
<optional> |
'b'
|
|
Returns:
The filename element.
(static) exists(filename) → {bool}
- Description:
Checks if a file exists.
Parameters:
| Name | Type | Description |
|---|---|---|
filename |
string | The file path name. |
Returns:
True if the file exists and is readable, false otherwise.
- Type
- bool
(static) load(filename) → {string}
- Description:
Loads a textual file.
Parameters:
| Name | Type | Description |
|---|---|---|
filename |
string | The file path name. |
Returns:
The file contents as a string.
- Type
- string
(static) save(filename, string)
- Description:
Saves a textual file.
- The file directory is created, if required.
- If the file already exists, a backup of name
filename~is created.
Parameters:
| Name | Type | Description |
|---|---|---|
filename |
string | The file path name. |
string |
string | The file contents as a string. |
(static) gnuplot(file, plot, dataopt)
- Description:
Generated a gnuplot interface display script.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
file |
string | The related data file name (without extension). By contract,
To display the gnuplot, run |
||
plot |
string | The gnuplot display commands.
|
||
data |
string |
<optional> |
""
|
An optional string with the plot data. |