SB++
Sandbox applications
Loading...
Searching...
No Matches
shared::TemporaryDirectory Class Reference

A Temporary Directory A directory that destroys itself upon falling out of scope. More...

#include <shared.hpp>

+ Collaboration diagram for shared::TemporaryDirectory:

Public Member Functions

 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.
 

Detailed Description

A Temporary Directory A directory that destroys itself upon falling out of scope.

Constructor & Destructor Documentation

◆ 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
parentThe path to create the directory at.
prefixA prefix for the name.
suffixA suffix for the name.
deferDefer creation. Call create().
Note
The directory deletes itself after falling out of scope.
+ Here is the call graph for this function:

Member Function Documentation

◆ get_path()

const std::string & shared::TemporaryDirectory::get_path ( ) const
inline

Return the path to the directory.

Returns
The path
+ Here is the caller graph for this function:

◆ 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
nameThe name of the new entity.
dirWhether the entity is a directory, and thus should be created.
Returns
The path to the new entity.
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: