35#ifndef NEKTAR_LIBUTILITIES_FILESYSTEM_HPP
36#define NEKTAR_LIBUTILITIES_FILESYSTEM_HPP
38#ifdef NEKTAR_USE_BOOST_FILESYSTEM
39#include <boost/filesystem.hpp>
40namespace fs = boost::filesystem;
41namespace fserrc = boost::system::errc;
43#ifdef NEKTAR_USE_GNU_FS_EXPERIMENTAL
44#include <experimental/filesystem>
45#include <system_error>
46namespace fs = std::experimental::filesystem;
50#include <system_error>
51namespace fs = std::filesystem;
68 return fs::path(path).make_preferred().string();
79static inline fs::path
UniquePath(std::string specFileStem)
81 std::random_device rd;
82 std::mt19937 generator(rd());
87 std::string chars =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
88 "abcdefghijklmnopqrstuvwxyz";
90 std::shuffle(chars.begin(), chars.end(), generator);
91 tmp = fs::path(
"tmp_" + specFileStem +
"_" + chars.substr(0, 6));
92 }
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...