A Temporary Directory A directory that destroys itself upon falling out of scope.
More...
#include <shared.hpp>
|
| | TemporaryDirectory (const std::string &parent=std::filesystem::temp_directory_path(), const std::string_view &prefix="", const std::string_view &suffix="", const bool &defer=false) |
| | Construct a Temporary Directory.
|
| |
| const std::string & | get_path () const |
| | Return the path to the directory.
|
| |
|
void | create () const |
| | Create the directory.
|
| |
| std::string | sub (const std::string &name, const bool &dir=false) const |
| | Create a subdirectory/file in the temp dir.
|
| |
|
const std::string & | get_name () const |
| | Return the name of the directory, excluding the path.
|
| |
A Temporary Directory A directory that destroys itself upon falling out of scope.
◆ TemporaryDirectory()
| shared::TemporaryDirectory::TemporaryDirectory |
( |
const std::string & | parent = std::filesystem::temp_directory_path(), |
|
|
const std::string_view & | prefix = "", |
|
|
const std::string_view & | suffix = "", |
|
|
const bool & | defer = false ) |
|
inline |
Construct a Temporary Directory.
- Parameters
-
| parent | The path to create the directory at. |
| prefix | A prefix for the name. |
| suffix | A suffix for the name. |
| defer | Defer creation. Call create(). |
- Note
- The directory deletes itself after falling out of scope.
◆ get_path()
| const std::string & shared::TemporaryDirectory::get_path |
( |
| ) |
const |
|
inline |
Return the path to the directory.
- Returns
- The path
◆ sub()
| std::string shared::TemporaryDirectory::sub |
( |
const std::string & | name, |
|
|
const bool & | dir = false ) const |
|
inline |
Create a subdirectory/file in the temp dir.
- Parameters
-
| name | The name of the new entity. |
| dir | Whether the entity is a directory, and thus should be created. |
- Returns
- The path to the new entity.
The documentation for this class was generated from the following files: