diff --git a/beast/module/core/diagnostic/UnitTestUtilities.h b/beast/module/core/diagnostic/UnitTestUtilities.h index e8c78edb4c..721dbc4ee4 100644 --- a/beast/module/core/diagnostic/UnitTestUtilities.h +++ b/beast/module/core/diagnostic/UnitTestUtilities.h @@ -99,6 +99,31 @@ public: HeapBlock data; }; +class TempDirectory +{ +public: + explicit TempDirectory (std::string const& root) + : directory (File::createTempFile (root)) + { + } + + ~TempDirectory() + { + directory.deleteRecursively(); + } + + String const& getFullPathName() const + { + return directory.getFullPathName(); + } + + TempDirectory(const TempDirectory&) = delete; + TempDirectory& operator=(const TempDirectory&) = delete; + +private: + File const directory; +}; + } // UnitTestUtilities } // beast