This module contain platform-independent file system operations.
More...
This module contain platform-independent file system operations.
◆ delete_dir()
stdx::expected< void, std::error_code > mysql_harness::delete_dir |
( |
const std::string & |
dir | ) |
|
|
noexcept |
Removes a directory.
- Parameters
-
dir | path of the directory to be removed; this directory must be empty |
- Returns
- void on success, error_code on failure
◆ delete_dir_recursive()
stdx::expected< void, std::error_code > mysql_harness::delete_dir_recursive |
( |
const std::string & |
dir | ) |
|
|
noexcept |
Removes directory and all its contents.
- Parameters
-
dir | path of the directory to be removed |
- Returns
- void on success, error_code on failure
◆ delete_file()
stdx::expected< void, std::error_code > mysql_harness::delete_file |
( |
const std::string & |
path | ) |
|
|
noexcept |
Removes a file.
- Parameters
-
path | of the file to be removed |
- Returns
- void on success, error_code on failure
◆ get_tmp_dir()
std::string mysql_harness::get_tmp_dir |
( |
const std::string & |
name = "router" | ) |
|
Creates a temporary directory with partially-random name and returns its path.
Creates a directory with a name of form {prefix}-{6 random alphanumerals}. For example, a possible directory name created by a call to get_tmp_dir("foo") might be: foo-3f9x0z
Such directory is usually meant to be used as a temporary directory (thus the "_tmp_" in the name of this function).
- Parameters
-
name | name to be used as a directory name prefix |
- Returns
- path to the created directory
- Exceptions
-
std::runtime_error | if operation failed |