Contains functions to interact with the file system.
Those functions are here only to avoid depending on an external library, and they provide only basic functionality. In particular, most of them were only written to work with absolute paths.
This set of functions is not meant to be complete, but it can be completed if need be.
|
static std::string | getExtension (const std::string &filename) |
| Get the extension of a file from an absolute path description. More...
|
|
static bool | listDirectory (const std::string &directoryPath, std::vector< std::string > &outputFilenames) |
| List the content of a directory. More...
|
|
static bool | listDirectory (const std::string &directoryPath, std::vector< std::string > &outputFilenames, const std::string &extension) |
| List the files in a directory which match the given extension. More...
|
|
static int | findFiles (const std::string &directoryPath, std::vector< std::string > &outputFilePaths, const std::string &extension, const int depth=0) |
| Find the files from a directory which match the given extension. More...
|
|
static bool | createDirectory (const std::string &path) |
| Create a directory. (This function accepts relative paths) More...
|
|
static bool | removeDirectory (const std::string &path) |
| Remove an empty directory. (This function accepts relative paths) More...
|
|
static bool | removeAll (const std::string &path) |
| Remove a non-empty directory. (This function accepts relative paths) More...
|
|
static bool | removeFile (const std::string &path) |
|
static std::string | findOrCreateAValidPath (const std::string path) |
| check that all element in the path exists or create them. (This function accepts relative paths) More...
|
|
static bool | exists (const std::string &path) |
| Return true if and only if the given file exists. More...
|
|
static bool | isDirectory (const std::string &path) |
| Return true if and only if the given file path corresponds to a directory. More...
|
|
static bool | isAbsolute (const std::string &path) |
| Return true if and only if the given file path is absolute. More...
|
|
static bool | isFile (const std::string &path) |
| Return true if and only if the given file path is an existing file. More...
|
|
static std::string | convertBackSlashesToSlashes (const std::string &path) |
| Replace backslashes with slashes. More...
|
|
static std::string | convertSlashesToBackSlashes (const std::string &path) |
| Replace slashes with backslashes. More...
|
|
static std::string | removeExtraSlashes (const std::string &path) |
| Replace consecutive occurrences of '/' with a single '/'. More...
|
|
static std::string | removeExtraBackSlashes (const std::string &path) |
| Replace consecutive occurrences of '\' with a single '\'. More...
|
|
static std::string | cleanPath (const std::string &path, separator s=SLASH) |
| Clean path (backslashes, extra slashes...) More...
|
|
static std::string | getParentDirectory (const std::string &path) |
| Strip the last component from a path. Return the path given in argument with its last non-slash component and trailing slashes removed, or "." if the path contains no slashes. E.g. /a/b/c --> /a/b. More...
|
|
static std::string | stripDirectory (const std::string &path) |
| Strip the directory components from a path. E.g. /a/b/c --> c. More...
|
|
static std::string | append (const std::string_view &existingPath, const std::string_view &toAppend) |
|
template<typename... Args> |
static std::string | append (const std::string_view &existingPath, const std::string_view &toAppend, Args &&... args) |
|