diff options
author | Kiminuo <kiminuo@protonmail.com> | 2021-02-01 13:35:28 +0100 |
---|---|---|
committer | Kiminuo <kiminuo@protonmail.com> | 2021-02-04 11:38:09 +0100 |
commit | 1bca2aa694cd85984c09699ae28daec313077462 (patch) | |
tree | dd3ea392cf4379cb03e1476736c5e968c759129e /src/util/getuniquepath.cpp | |
parent | ea5a50f92a6ff81b1d2dd67cdc3663e0e66733ac (diff) |
Introduce GetUniquePath(base) helper method to replace boost::filesystem::unique_path() which is not available in std::filesystem.
Diffstat (limited to 'src/util/getuniquepath.cpp')
-rw-r--r-- | src/util/getuniquepath.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/getuniquepath.cpp b/src/util/getuniquepath.cpp new file mode 100644 index 0000000000..9839d2f624 --- /dev/null +++ b/src/util/getuniquepath.cpp @@ -0,0 +1,10 @@ +#include <random.h> +#include <fs.h> +#include <util/strencodings.h> + +fs::path GetUniquePath(const fs::path& base) +{ + FastRandomContext rnd; + fs::path tmpFile = base / HexStr(rnd.randbytes(8)); + return tmpFile; +}
\ No newline at end of file |