14 #ifndef MYNTEYE_UTILS_FILES_H_ 15 #define MYNTEYE_UTILS_FILES_H_ 17 #include "mynteyed/stubs/global.h" 18 #include "mynteyed/util/strings.h" 20 #if defined(MYNTEYE_OS_WIN) && !defined(MYNTEYE_OS_MINGW) \ 21 && !defined(MYNTEYE_OS_CYGWIN) 29 MYNTEYE_BEGIN_NAMESPACE
33 bool _mkdir(
const std::string &path) {
34 #if defined(MYNTEYE_OS_MINGW) || defined(MYNTEYE_OS_CYGWIN) 35 const int status = ::mkdir(path.c_str());
36 #elif defined(MYNTEYE_OS_WIN) 37 const int status = ::_mkdir(path.c_str());
40 mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
43 if (status != 0 && errno != EEXIST) {
48 if (errno == EEXIST) {
59 bool mkdir(
const std::string &path) {
60 auto &&dirs = strings::split(path, MYNTEYE_OS_SEP);
61 auto &&size = dirs.size();
64 std::string p{dirs[0]};
67 for (std::size_t i = 1; i < size; i++) {
68 p.append(MYNTEYE_OS_SEP).append(dirs[i]);
79 #endif // MYNTEYE_UTILS_FILES_H_