| 71 | |
| 72 | #ifndef _WIN32 |
| 73 | int makePathImpl(const std::string::value_type *path, mode_t mode) |
| 74 | { |
| 75 | struct stat st; |
| 76 | int status = 0; |
| 77 | |
| 78 | if (stat(path, &st) != 0) |
| 79 | { |
| 80 | // Directory does not exist. EEXIST for race condition |
| 81 | if (mkdir(path, mode) != 0 && errno != EEXIST) |
| 82 | status = -1; |
| 83 | } |
| 84 | else if (!S_ISDIR(st.st_mode)) |
| 85 | { |
| 86 | // errno = ENOTDIR; |
| 87 | status = -1; |
| 88 | } |
| 89 | |
| 90 | return status; |
| 91 | } |
| 92 | #endif |
| 93 | |
| 94 | bool makeDirectory(const std::string& path) |