| 115 | // ---------------------------------------------------------------------------------------- |
| 116 | |
| 117 | void create_directory ( |
| 118 | const std::string& dir |
| 119 | ) |
| 120 | { |
| 121 | if (CreateDirectoryA(dir.c_str(),0) == 0) |
| 122 | { |
| 123 | // an error has occurred |
| 124 | if (GetLastError() == ERROR_ALREADY_EXISTS) |
| 125 | { |
| 126 | // make sure this is actually a directory |
| 127 | DWORD attribs = GetFileAttributesA(dir.c_str()); |
| 128 | if (attribs == INVALID_FILE_ATTRIBUTES || |
| 129 | (attribs&FILE_ATTRIBUTE_DIRECTORY) == 0) |
| 130 | { |
| 131 | // it isn't a directory |
| 132 | throw dir_create_error(dir); |
| 133 | } |
| 134 | } |
| 135 | else |
| 136 | { |
| 137 | throw dir_create_error(dir); |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | // ---------------------------------------------------------------------------------------- |
| 143 |
nothing calls this directly
no test coverage detected