| 412 | } |
| 413 | |
| 414 | int mkdirRecursive(const char *pathname) { |
| 415 | // let caller ensure pathname is not null |
| 416 | const char path_token = '/'; |
| 417 | size_t pos = 0; |
| 418 | const std::string pathname_view(pathname); |
| 419 | while (pos < pathname_view.size()) { |
| 420 | auto find_path_token = pathname_view.find(path_token, pos); |
| 421 | if (find_path_token == std::string::npos) { |
| 422 | return mkdirIfNotExist(pathname_view.c_str()); |
| 423 | } |
| 424 | int ret = |
| 425 | mkdirIfNotExist(pathname_view.substr(0, find_path_token + 1).c_str()); |
| 426 | if (ret) return ret; |
| 427 | pos = find_path_token + 1; |
| 428 | } |
| 429 | return 0; |
| 430 | } |
| 431 | |
| 432 | uint64_t getUintEnvVar(const std::string &str, uint64_t default_para) { |
| 433 | const char *env_raw_ptr = std::getenv(str.c_str()); |
no test coverage detected