#include <tools/Filesystem.hpp>
|
constexpr static char | pathsListSeparator () noexcept |
|
constexpr static char | pathSeparator () noexcept |
|
static std::string | joinPath (const std::vector< std::string > &PathParts) |
|
static std::string | filename (const std::string &Path) |
|
static std::string | basename (const std::string &Path) |
|
static std::string | dirname (const std::string &Path) |
|
static std::string | extension (const std::string &Path) |
|
static std::string | currentPath () |
|
static std::string | absolutePath (const std::string &Path) |
|
static std::string | cleanPath (const std::string &Path) |
|
static bool | isDirectory (const std::string &Path) |
|
static bool | isFile (const std::string &Path) |
|
static bool | makeDirectory (const std::string &Path) |
|
static bool | removeDirectory (const std::string &Path) |
|
static std::string | makeUniqueSubdirectory (const std::string &Path, const std::string &SubdirName) |
|
static std::string | makeUniqueFile (const std::string &Path, const std::string &FileName) |
|
static bool | removeFile (const std::string &Path) |
|
static bool | copyFile (const std::string &SrcPath, const std::string &DestPath) |
|
static bool | renameFile (const std::string &OriginalPath, const std::string &NewPath) |
|
static bool | copyDirectory (const std::string &SrcPath, const std::string &DestPath, const bool DontCopyDotDirs=false) |
|
◆ Filesystem()
openfluid::tools::Filesystem::Filesystem |
( |
| ) |
|
|
delete |
◆ absolutePath()
static std::string openfluid::tools::Filesystem::absolutePath |
( |
const std::string & |
Path | ) |
|
|
static |
Returns the absolute path of the given path. If the given path is already an absolute path, it is returned as-is.
- Parameters
-
[in] | Path | the path to make absolute
|
- Returns
- the absolute path
◆ basename()
static std::string openfluid::tools::Filesystem::basename |
( |
const std::string & |
Path | ) |
|
|
static |
Returns the complete base name of the file in the given path
- Parameters
-
- Returns
- the base name of the file
◆ cleanPath()
static std::string openfluid::tools::Filesystem::cleanPath |
( |
const std::string & |
Path | ) |
|
|
static |
Cleans the given path : removes trailing and redundant slashes, resolves '.' and '..' as far as possible.
- Parameters
-
[in] | Path | the path to clean
|
- Returns
- the cleaned path
◆ copyDirectory()
static bool openfluid::tools::Filesystem::copyDirectory |
( |
const std::string & |
SrcPath, |
|
|
const std::string & |
DestPath, |
|
|
const bool |
DontCopyDotDirs = false |
|
) |
| |
|
static |
Recursively copies a directory from source to destination.
- Parameters
-
[in] | SrcPath | the source path |
[in] | DestPath | the destination path |
[in] | DontCopyDotDirs | if set to true, it ignores the directories beginning with a dot ('.'). Default is false |
- Returns
- true if the directory was successfully copied, false otherwise
◆ copyFile()
static bool openfluid::tools::Filesystem::copyFile |
( |
const std::string & |
SrcPath, |
|
|
const std::string & |
DestPath |
|
) |
| |
|
static |
Copies a file from source to destination.
- Parameters
-
[in] | SrcPath | the source path |
[in] | DestPath | the destination path |
- Returns
- true if the file was successfully copied, false otherwise
◆ currentPath()
static std::string openfluid::tools::Filesystem::currentPath |
( |
| ) |
|
|
static |
Returns the current path
- Returns
- the current path
◆ dirname()
static std::string openfluid::tools::Filesystem::dirname |
( |
const std::string & |
Path | ) |
|
|
static |
Returns the directory name (parent path) of the given path
- Parameters
-
- Returns
- the directory name
◆ extension()
static std::string openfluid::tools::Filesystem::extension |
( |
const std::string & |
Path | ) |
|
|
static |
Returns the extension of the file of the given path
- Parameters
-
- Returns
- the extension
◆ filename()
static std::string openfluid::tools::Filesystem::filename |
( |
const std::string & |
Path | ) |
|
|
static |
Returns the name of the file in the given path
- Parameters
-
- Returns
- the filename
◆ isDirectory()
static bool openfluid::tools::Filesystem::isDirectory |
( |
const std::string & |
Path | ) |
|
|
static |
Returns true if the given path is a directory
- Parameters
-
- Returns
- true or false
◆ isFile()
static bool openfluid::tools::Filesystem::isFile |
( |
const std::string & |
Path | ) |
|
|
static |
Returns true if the given path is a file or a valid symbolic link
- Parameters
-
- Returns
- true or false
◆ joinPath()
static std::string openfluid::tools::Filesystem::joinPath |
( |
const std::vector< std::string > & |
PathParts | ) |
|
|
static |
Returns a joined path string from a vector of path parts, using the '/' separator
- Parameters
-
[in] | PathParts | a vector of path parts |
- Returns
- the joined path
◆ makeDirectory()
static bool openfluid::tools::Filesystem::makeDirectory |
( |
const std::string & |
Path | ) |
|
|
static |
Creates the directory of the given path. It creates all parent directories necessary to create the directory. If the directory already exists, it does nothing.
- Parameters
-
- Returns
- true if the directory has been successfully created or if it already exists, false otherwise
◆ makeUniqueFile()
static std::string openfluid::tools::Filesystem::makeUniqueFile |
( |
const std::string & |
Path, |
|
|
const std::string & |
FileName |
|
) |
| |
|
static |
Creates a unique file in the given path, using the given File name and extension as prefix and suffix. If the file already exists, it adds an incremental part to the file name. If the Path does not exists, it creates all needed parent directories.
- Parameters
-
[in] | Path | the given path for the file |
[in] | FileName | the file name used to make a unique one |
- Returns
- the full path of the created unique file
◆ makeUniqueSubdirectory()
static std::string openfluid::tools::Filesystem::makeUniqueSubdirectory |
( |
const std::string & |
Path, |
|
|
const std::string & |
SubdirName |
|
) |
| |
|
static |
Creates a unique subdirectory in the given path, using the given subdirectory name as a prefix. If the subdirectory already exists, it adds an incremental suffix to the subdirectory name. It creates all parent directories necessary to create the subdirectory.
- Parameters
-
[in] | Path | the given path |
[in] | SubdirName | the given path |
- Returns
- the full path of the created unique subdirectory
◆ pathSeparator()
constexpr static char openfluid::tools::Filesystem::pathSeparator |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
◆ pathsListSeparator()
constexpr static char openfluid::tools::Filesystem::pathsListSeparator |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
◆ removeDirectory()
static bool openfluid::tools::Filesystem::removeDirectory |
( |
const std::string & |
Path | ) |
|
|
static |
Removes the directory of the given path. It recursively deletes all contents of the directory.
- Parameters
-
- Returns
- true if the directory has been successfully deleted, false otherwise
◆ removeFile()
static bool openfluid::tools::Filesystem::removeFile |
( |
const std::string & |
Path | ) |
|
|
static |
Removes the file of the given path.
- Parameters
-
- Returns
- true if the file was successfully deleted, false otherwise
◆ renameFile()
static bool openfluid::tools::Filesystem::renameFile |
( |
const std::string & |
OriginalPath, |
|
|
const std::string & |
NewPath |
|
) |
| |
|
static |
Rename a file.
- Parameters
-
[in] | OriginalPath | the original file path |
[in] | NewPath | the new file path |
- Returns
- true if the file was successfully renamed, false otherwise
The documentation for this class was generated from the following file: