utils: add TempDir RAII class

For tests
This commit is contained in:
Dirk-Jan C. Binnema
2022-04-09 19:14:48 +03:00
parent 100b41b257
commit a7e6d57286
2 changed files with 62 additions and 0 deletions

View File

@ -443,6 +443,37 @@ private:
*/
void allow_warnings();
/**
* For unit-tests, a RAII tempdir.
*
*/
struct TempDir {
/**
* Construct a temporary directory
*/
TempDir();
/**
* DTOR; removes the temporary directory
*
*
* @return
*/
~TempDir();
/**
* Path to the temporary directory
*
* @return the path.
*
*
*/
const std::string& path() {return path_; }
private:
std::string path_;
};
} // namespace Mu
#endif /* __MU_UTILS_HH__ */