33[[nodiscard]]
static auto path_exists(
const std::string& path) ->
bool {
34 return ::GetFileAttributesA(path.c_str()) != INVALID_FILE_ATTRIBUTES;
38 if (path_exists(path)) {
44 pos = path.find_first_of(
"/\\", pos);
45 if (pos == std::string::npos) {
48 const auto parent = path.substr(0, pos);
51 if (parent.empty() || path_exists(parent)) {
54 ::_mkdir(parent.c_str());
55 if (pos >= path.size()) {
62 const std::size_t pos = path.find_last_of(
"/\\");
63 if (pos == std::string::npos) {
82[[nodiscard]]
auto path_exists(
const std::string& path) ->
bool {
84 return ::stat(path.c_str(), &buf) == 0;
90 if (path_exists(path)) {
96 pos = path.find_first_of(
'/', pos);
97 if (pos == std::string::npos) {
100 const auto parent = path.substr(0, pos);
103 if (parent.empty() || path_exists(parent)) {
107 const auto mode = ::mode_t(0755);
108 ::mkdir(parent.c_str(), mode);
109 if (pos >= path.size()) {
116 const std::size_t pos = path.find_last_of(
'/');
117 if (pos == std::string::npos) {
Namespace of utility functions and classes.
void prepare_directory(const std::string &path)
Prepare a directory.
void prepare_directory_for(const std::string &path)
Prepare a directory for a file.
Namespace of stat_bench source codes.
Declaration of prepare_directory function.