This PR makes it easier in #20744 to remove our dependency on the boost::filesystem::unique_path() function which does not have a direct equivalent in C++17.
This PR attempts to re-implement boost::filesystem::unique_path() as GetUniquePath(path) but the implementations are not meant to be the same.
Note:
Boost 1.75.0 implementation of
unique_path: https://github.com/boostorg/filesystem/blob/9cab675b71e98706886a87afe7c19eb9da568961/src/unique_path.cpp#L235In the previous implementation, I attempted to add:
fs::path GetUniquePath(const fs::path& base) { FastRandomContext rnd; fs::path tmpFile = base / HexStr(rnd.randbytes(8)); return tmpFile; }to
fs.cppbut this leads to a circular dependency: "fs -> random -> logging -> fs". That is why the modified implementation adds a new file.