A class for directory operations.
More...
#include <Dir.h>
|
|
| CDir ()=default |
| | Default constructor for CDir.
|
| |
| | CDir (CPath i_oPath) |
| | Construct a CDir object using the provided path. More...
|
| |
| std::vector< CPath > | getDirectoryFiles (bool i_bIsRecursive=false, std::optional< std::vector< std::string >> i_astExtensionFilters=std::nullopt) |
| | Get the files in the directory. More...
|
| |
A class for directory operations.
This class encapsulates operations related to directories like getting directory files, creating directories, creating directory symlink, and more.
Example
The following example demonstrates how to use various functionalities of the CDir class.
std::vector<CPath> txtFiles = dir.
getDirectoryFiles(
true, std::vector<std::string>{
".txt"});
A class for directory operations.
Definition: Dir.h:46
static CPath getTempDirectoryPath()
Static function to get the path of the temporary directory.
Definition: Dir.h:90
static bool createDirectories(const CPath &i_oPath)
Static function to create directories.
Definition: Dir.h:70
std::vector< CPath > getDirectoryFiles(bool i_bIsRecursive=false, std::optional< std::vector< std::string >> i_astExtensionFilters=std::nullopt)
Get the files in the directory.
Definition: Dir.cpp:29
static bool isDirectory(const CPath &i_oPath)
Static function to check if a path is a directory.
Definition: Dir.h:84
CDir()=default
Default constructor for CDir.
static void createDirectorySymlink(const CPath &i_oTargetPath, const CPath &i_oLinkPath)
Static function to create a symlink for a directory.
Definition: Dir.h:77
◆ CDir()
| Devel::IO::CDir::CDir |
( |
CPath |
i_oPath | ) |
|
|
inlineexplicit |
Construct a CDir object using the provided path.
- Parameters
-
| i_oPath | - The path for the directory. |
◆ createDirectories()
| static bool Devel::IO::CDir::createDirectories |
( |
const CPath & |
i_oPath | ) |
|
|
inlinestatic |
Static function to create directories.
- Parameters
-
| i_oPath | - The path where the directories should be created. |
- Returns
- true if the directories were successfully created, false otherwise.
◆ createDirectorySymlink()
| static void Devel::IO::CDir::createDirectorySymlink |
( |
const CPath & |
i_oTargetPath, |
|
|
const CPath & |
i_oLinkPath |
|
) |
| |
|
inlinestatic |
Static function to create a symlink for a directory.
- Parameters
-
| i_oTargetPath | - The original directory. |
| i_oLinkPath | - The symlink path. |
◆ getDirectoryFiles()
| std::vector< Devel::IO::CPath > Devel::IO::CDir::getDirectoryFiles |
( |
bool |
i_bIsRecursive = false, |
|
|
std::optional< std::vector< std::string >> |
i_astExtensionFilters = std::nullopt |
|
) |
| |
Get the files in the directory.
- Parameters
-
| i_bIsRecursive | - Whether to recursively look in subdirectories. |
| i_astExtensionFilters | - Optional list of file extensions to filter. |
- Returns
- A vector containing the paths of the files.
◆ getTempDirectoryPath()
| static CPath Devel::IO::CDir::getTempDirectoryPath |
( |
| ) |
|
|
inlinestatic |
Static function to get the path of the temporary directory.
- Returns
- The path of the temporary directory.
◆ isDirectory()
| static bool Devel::IO::CDir::isDirectory |
( |
const CPath & |
i_oPath | ) |
|
|
inlinestatic |
Static function to check if a path is a directory.
- Parameters
-
| i_oPath | - The path to check. |
- Returns
- true if the path is a directory, false otherwise.
The documentation for this class was generated from the following files:
- /home/runner/work/devel-library/devel-library/IO/Dir/Dir.h
- /home/runner/work/devel-library/devel-library/IO/Dir/Dir.cpp