35#ifndef NEKTAR_LIBUTILITIES_FILESYSTEM_HPP
36#define NEKTAR_LIBUTILITIES_FILESYSTEM_HPP
38#ifdef NEKTAR_USE_GNU_FS_EXPERIMENTAL
39#include <experimental/filesystem>
40namespace fs = std::experimental::filesystem;
43namespace fs = std::filesystem;
58 return fs::path(path).make_preferred().string();
69static inline fs::path
UniquePath(std::string specFileStem)
71 std::random_device rd;
72 std::mt19937 generator(rd());
77 std::string chars =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
78 "abcdefghijklmnopqrstuvwxyz";
80 std::shuffle(chars.begin(), chars.end(), generator);
81 tmp = fs::path(
"tmp_" + specFileStem +
"_" + chars.substr(0, 6));
82 }
while (fs::exists(tmp));
static std::string PortablePath(const fs::path &path)
create portable path on different platforms for std::filesystem path.
static fs::path UniquePath(std::string specFileStem)
Create a unique (random) path, based on an input stem string. The returned string is a filename or di...