nothing of note

master
Avril 5 years ago
parent 7641b1b086
commit 1af153af6d
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -134,6 +134,31 @@ const unsigned char* get_data(int i)
return data; return data;
} }
template<typename Path>
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) int main(int argc,char** argv)
{ {
auto path = fs::temp_directory_path() / get_uuid(); 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"; cout << "Extracting " << DATA_COUNT << " files to " << path << "...\n";
#endif #endif
fs::create_directory(path); DirTree tree(path);
for(int i=0;i<DATA_COUNT;i++) for(int i=0;i<DATA_COUNT;i++)
{ {
auto data = get_data(i); auto data = get_data(i);
@ -162,7 +187,7 @@ int main(int argc,char** argv)
cout << " FAILED: Invalid hash\n"; cout << " FAILED: Invalid hash\n";
cerr << "Aborting.\n"; cerr << "Aborting.\n";
#endif #endif
goto end; return 1;
} else { } else {
#ifndef SILENT #ifndef SILENT
cout << " OK\n"; cout << " OK\n";
@ -178,7 +203,5 @@ int main(int argc,char** argv)
#endif #endif
system(execstr.c_str()); system(execstr.c_str());
} }
end:
fs::remove_all(path);
return 0; return 0;
} }

Loading…
Cancel
Save