fs/scoped: add scoped_dir convenience function
This commit is contained in:
parent
aca6d6fd08
commit
92dda992ee
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "./scoped.hpp"
|
||||
#include "./tmp.hpp"
|
||||
|
||||
#include <cruft/util/debug/assert.hpp>
|
||||
|
||||
@ -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 ());
|
||||
}
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user