MCPcopy Create free account
hub / github.com/Cambricon/mlu-ops / mkdirRecursive

Function mkdirRecursive

core/tool.cpp:414–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414int 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
432uint64_t getUintEnvVar(const std::string &str, uint64_t default_para) {
433 const char *env_raw_ptr = std::getenv(str.c_str());

Callers 2

dumpTraceDataMethod · 0.85
mkdirMethod · 0.85

Calls 3

mkdirIfNotExistFunction · 0.85
findMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected