userver: fs::blocking::TempDirectory Class Reference
Loading...
Searching...
No Matches
fs::blocking::TempDirectory Class Referencefinal

#include <userver/fs/blocking/temp_directory.hpp>

Detailed Description

A unique directory for temporary files. The directory is deleted when the TempDirectory is destroyed.

Note
The directory, as well as any newly created parent directories, has permissions=0700.

Definition at line 19 of file temp_directory.hpp.

Public Member Functions

 TempDirectory (TempDirectory &&other) noexcept
 
TempDirectoryoperator= (TempDirectory &&other) noexcept
 
const std::string & GetPath () const
 The directory path.
 
void Remove () &&
 Remove the directory early.
 

Static Public Member Functions

static TempDirectory Create ()
 Create the directory at the default path for temporary files.
 
static TempDirectory Create (std::string_view parent_path, std::string_view name_prefix)
 Create the directory at the specified path.
 
static TempDirectory Adopt (std::string path)
 Take ownership of an existing directory.
 

Member Function Documentation

◆ Create() [1/2]

static TempDirectory fs::blocking::TempDirectory::Create ( )
static

Create the directory at the default path for temporary files.

Exceptions
std::runtime_error

◆ Create() [2/2]

static TempDirectory fs::blocking::TempDirectory::Create ( std::string_view parent_path,
std::string_view name_prefix )
static

Create the directory at the specified path.

Parameters
parent_pathThe directory where the temporary directory will be created
name_prefixDirectory name prefix, a random string will be added after the prefix
Exceptions
std::runtime_error

◆ Remove()

void fs::blocking::TempDirectory::Remove ( ) &&

Remove the directory early.

Exceptions
std::runtime_error

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