1#ifndef PROVSQL_SCOPED_TEMPDIR_H
2#define PROVSQL_SCOPED_TEMPDIR_H
32 char buf[] =
"/tmp/provsqlXXXXXX";
33 if (mkdtemp(buf) ==
nullptr)
39 for (
const auto &f :
files_) (void)::unlink(f.c_str());
40 (void)::rmdir(
path_.c_str());
46 std::string
file(
const std::string &basename) {
47 std::string p =
path_ +
"/" + basename;
Exception type thrown by circuit operations on invalid input.
std::string file(const std::string &basename)
Build a path under the temp dir and register it for cleanup.
void track(const std::string &p)
Also track a file we did not create through file() (e.g.
ScopedTempDir(const ScopedTempDir &)=delete
const std::string & path() const
void keep()
Leave the directory on disk; cleanup is skipped at scope exit.
ScopedTempDir & operator=(const ScopedTempDir &)=delete
std::vector< std::string > files_
Uniform error-reporting macros for ProvSQL.