Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::filesystem::temporary_directory Class Reference

An RAII helper class to manage a temporary directory. More...

Public Member Functions

 temporary_directory ()
 Create a new temporary directory with a unique name.
 
 temporary_directory (path_string root)
 Create a new temporary directory with a unique name.
 
 temporary_directory (temporary_directory &&)=default
 default move constructor
 
 temporary_directory (temporary_directory const &)=delete
 deleted copy constructor
 
 ~temporary_directory ()
 Remove the temporary directory and all its contents.
 
auto operator= (temporary_directory &&) -> temporary_directory &=default
 default move assignment operator
 
auto operator= (temporary_directory const &) -> temporary_directory &=delete
 deleted copy assignment operator
 
auto path () const noexcept -> path_string const &
 Get the full path of the temporary directory.
 

Detailed Description

An RAII helper class to manage a temporary directory.

The directory is created on construction, and recursively removed on destruction.

Constructor & Destructor Documentation

◆ temporary_directory() [1/4]

arene::base::filesystem::temporary_directory::temporary_directory ( path_string root)
explicit

Create a new temporary directory with a unique name.

Parameters
rootparent directory which will contain the temporary directory
Exceptions
std::system_errorIf an error occurs that prevents inspecting or modifying a directory.

If the TMPDIR environment variable is set, the temporary directory is created under the specified directory, otherwise it is created under root

◆ temporary_directory() [2/4]

arene::base::filesystem::temporary_directory::temporary_directory ( )
inline

Create a new temporary directory with a unique name.

If the TMPDIR environment variable is set, the temporary directory is created under the specified directory, otherwise it is created under /tmp

◆ ~temporary_directory()

arene::base::filesystem::temporary_directory::~temporary_directory ( )

Remove the temporary directory and all its contents.

◆ temporary_directory() [3/4]

arene::base::filesystem::temporary_directory::temporary_directory ( temporary_directory const & )
delete

deleted copy constructor

◆ temporary_directory() [4/4]

arene::base::filesystem::temporary_directory::temporary_directory ( temporary_directory && )
default

default move constructor

Member Function Documentation

◆ operator=() [1/2]

auto arene::base::filesystem::temporary_directory::operator= ( temporary_directory && ) -> temporary_directory &=default
default

default move assignment operator

◆ operator=() [2/2]

auto arene::base::filesystem::temporary_directory::operator= ( temporary_directory const & ) -> temporary_directory &=delete
delete

deleted copy assignment operator

◆ path()

auto arene::base::filesystem::temporary_directory::path ( ) const -> path_string const&
inlinenoexcept

Get the full path of the temporary directory.

Returns
reference to the path string

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