|
coral
A C++ library for distributed co-simulation
|
An RAII object that creates a unique directory on construction and recursively deletes it again on destruction. More...
#include "coral/util/filesystem.hpp"
Public Member Functions | |
| TempDir (const boost::filesystem::path &parent=boost::filesystem::path()) | |
| Creates a new temporary directory. More... | |
| TempDir (TempDir &&other) CORAL_NOEXCEPT | |
| Move constructor. More... | |
| TempDir & | operator= (TempDir &&) CORAL_NOEXCEPT |
| Move assignment operator. See TempDir(TempDir&&) for semantics. | |
| ~TempDir () CORAL_NOEXCEPT | |
| Destructor. Recursively deletes the directory. | |
| const boost::filesystem::path & | Path () const |
| Returns the path to the directory. | |
An RAII object that creates a unique directory on construction and recursively deletes it again on destruction.
|
explicit |
Creates a new temporary directory.
The name of the new directory will be randomly generated, and there are three options of where it will be created, depending on the value of parent. In the following, temp refers to a directory suitable for temporary files under the conventions of the operating system (e.g. /tmp under UNIX-like systems), and name refers to the randomly generated name mentioned above.
parent is empty: temp/nameparent is relative: temp/parent/nameparent is absolute: parent/name | coral::util::TempDir::TempDir | ( | TempDir && | other | ) |
Move constructor.
Ownership of the directory is transferred from other to this. Afterwards, other no longer refers to any directory, meaning that other.Path() will return an empty path, and its destructor will not perform any filesystem operations.
1.8.11