unique_path doesn't exist in std::filesystem

This commit is contained in:
tsjost 2021-10-12 16:50:19 +02:00
parent bf345af47a
commit 26983ffa3d

View file

@ -7,6 +7,7 @@
#include <fstream> #include <fstream>
#include <map> #include <map>
#include <chrono>
#include <rw/debug.hpp> #include <rw/debug.hpp>
#include <rw/filesystem.hpp> #include <rw/filesystem.hpp>
@ -92,7 +93,8 @@ protected:
private: private:
static rwfs::path getRandomFilePath(const rwfs::path &dirname) { static rwfs::path getRandomFilePath(const rwfs::path &dirname) {
return rwfs::unique_path(dirname / "openrw_test_%%%%%%%%%%%%%%%%"); const long current_time = std::chrono::high_resolution_clock::now().time_since_epoch().count();
return dirname / ("openrw_test_" + std::to_string(current_time));
} }
static rwfs::path getRandomFilePath() { static rwfs::path getRandomFilePath() {
return getRandomFilePath(rwfs::temp_directory_path()); return getRandomFilePath(rwfs::temp_directory_path());