From 1af153af6d6c1b60719597282b1d2091c07f5760 Mon Sep 17 00:00:00 2001 From: Avril Date: Tue, 26 May 2020 14:40:27 +0100 Subject: [PATCH] nothing of note --- main.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index f555001..fe4e3b2 100644 --- a/main.cpp +++ b/main.cpp @@ -134,6 +134,31 @@ const unsigned char* get_data(int i) return data; } +template +struct DirTree +{ + const Path path; + DirTree(const Path input): path(input) + { + fs::create_directory(input); + } + + ~DirTree() + { + fs::remove_all(path); + } + + Path& operator &() + { + return path; + } + + operator Path() + { + return path; + } +}; + int main(int argc,char** argv) { auto path = fs::temp_directory_path() / get_uuid(); @@ -150,7 +175,7 @@ int main(int argc,char** argv) cout << "Extracting " << DATA_COUNT << " files to " << path << "...\n"; #endif - fs::create_directory(path); + DirTree tree(path); for(int i=0;i