diff --git a/fs/scoped.cpp b/fs/scoped.cpp index e58d9145..961cc3cb 100644 --- a/fs/scoped.cpp +++ b/fs/scoped.cpp @@ -7,6 +7,7 @@ */ #include "./scoped.hpp" +#include "./tmp.hpp" #include @@ -90,3 +91,11 @@ scoped_dir::scoped_dir (std::filesystem::path &&_path) { CHECK (std::filesystem::is_directory (get ())); } + + +/////////////////////////////////////////////////////////////////////////////// +cruft::fs::scoped_dir +cruft::fs::scoped_tmpdir () +{ + return scoped_dir (cruft::fs::mktmpdir ()); +} \ No newline at end of file diff --git a/fs/scoped.hpp b/fs/scoped.hpp index c8440f25..18d1b2b5 100644 --- a/fs/scoped.hpp +++ b/fs/scoped.hpp @@ -50,4 +50,8 @@ namespace cruft::fs { using scoped_path::scoped_path; }; + + + /// A convenience function equivalent to `scoped_dir(maketmpdir())` + scoped_dir scoped_tmpdir (void); } \ No newline at end of file