rcpputils
master
C++ API providing common utilities and data structures.
|
Classes | |
class | path |
Drop-in replacement for std::filesystem::path. More... | |
Functions | |
bool | is_regular_file (const path &p) noexcept |
Check if the path is a regular file. More... | |
bool | is_directory (const path &p) noexcept |
Check if the path is a directory. More... | |
uint64_t | file_size (const path &p) |
Get the file size of the path. More... | |
bool | exists (const path &path_to_check) |
Check if a path exists. More... | |
path | temp_directory_path () |
Get a path to a location in the temporary directory, if it's available. More... | |
path | current_path () |
Return current working directory. More... | |
bool | create_directories (const path &p) |
Create a directory with the given path p. More... | |
bool | remove (const path &p) |
Remove the file or directory at the path p. More... | |
bool | remove_all (const path &p) |
Remove the directory at the path p and its content. More... | |
path | remove_extension (const path &file_path, int n_times=1) |
Remove extension(s) from a path. More... | |
|
inlinenoexcept |
Check if the path is a regular file.
p | The path to check |
|
inlinenoexcept |
Check if the path is a directory.
p | The path to check |
|
inline |
Get the file size of the path.
p | The path to get the file size of. |
std::sytem_error |
|
inline |
Check if a path exists.
path_to_check | The path to check. |
|
inline |
Get a path to a location in the temporary directory, if it's available.
|
inline |
Return current working directory.
std::system_error |
|
inline |
Create a directory with the given path p.
This builds directories recursively and will skip directories if they are already created.
|
inline |
Remove the file or directory at the path p.
p | The path of the object to remove. |
|
inline |
Remove the directory at the path p and its content.
Additionally to
The | path of the directory to remove. |
Remove extension(s) from a path.
An extension is defined as text starting from the end of a path to the first period (.) character.
file_path | The file path string. |
n_times | The number of extensions to remove if there are multiple extensions. |