* Creates a folder at the specified path. * @note Only creates the last folder on the path. * @param path Full path. * @return Folder created or not. */
| 458 | * @return Folder created or not. |
| 459 | */ |
| 460 | bool createFolder(const std::string &path) |
| 461 | { |
| 462 | #ifdef _WIN32 |
| 463 | int result = CreateDirectoryA(path.c_str(), 0); |
| 464 | if (result == 0) |
| 465 | return false; |
| 466 | else |
| 467 | return true; |
| 468 | #else |
| 469 | mode_t process_mask = umask(0); |
| 470 | int result = mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); |
| 471 | umask(process_mask); |
| 472 | if (result == 0) |
| 473 | return true; |
| 474 | else |
| 475 | return false; |
| 476 | #endif |
| 477 | } |
| 478 | |
| 479 | /** |
| 480 | * Adds an ending slash to a path if necessary. |
no outgoing calls
no test coverage detected