Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
dmlc::TemporaryDirectory Class Reference

Manager class for temporary directories. Whenever a new TemporaryDirectory object is constructed, a temporary directory is created. The directory is deleted when the object is deleted or goes out of scope. Note: no symbolic links are allowed inside the temporary directory. More...

#include <filesystem.h>

Public Member Functions

 TemporaryDirectory (bool verbose=false)
 Default constructor. Creates a new temporary directory with a unique name.
 
 ~TemporaryDirectory ()
 Destructor. Will perform recursive deletion via RecursiveDelete()
 

Data Fields

std::string path
 Full path of the temporary directory.
 

Detailed Description

Manager class for temporary directories. Whenever a new TemporaryDirectory object is constructed, a temporary directory is created. The directory is deleted when the object is deleted or goes out of scope. Note: no symbolic links are allowed inside the temporary directory.

Usage example:

void foo() {
// Create a file my_file.txt inside the temporary directory
std::ofstream of(tempdir.path + "/my_file.txt");
// ... write to my_file.txt ...
// ... use my_file.txt
// When tempdir goes out of scope, the temporary directory is deleted
}
Manager class for temporary directories. Whenever a new TemporaryDirectory object is constructed,...
Definition filesystem.h:54
std::string path
Full path of the temporary directory.
Definition filesystem.h:126

Constructor & Destructor Documentation

◆ TemporaryDirectory()

dmlc::TemporaryDirectory::TemporaryDirectory ( bool  verbose = false)
inlineexplicit

Default constructor. Creates a new temporary directory with a unique name.

Parameters
verbosewhether to emit extra messages

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