static
| 309 | |
| 310 | // static |
| 311 | bool Platform::MkDirRecursively(std::string const & dirName) |
| 312 | { |
| 313 | CHECK(!dirName.empty(), ()); |
| 314 | |
| 315 | std::string::value_type const sep[] = {base::GetNativeSeparator(), 0}; |
| 316 | std::string path = dirName.starts_with(sep[0]) ? sep : "."; |
| 317 | for (auto const & t : strings::Tokenize(dirName, sep)) |
| 318 | { |
| 319 | path = base::JoinPath(path, std::string{t}); |
| 320 | if (!IsFileExistsByFullPath(path)) |
| 321 | { |
| 322 | switch (MkDir(path)) |
| 323 | { |
| 324 | case ERR_OK: break; |
| 325 | case ERR_FILE_ALREADY_EXISTS: |
| 326 | { |
| 327 | if (!IsDirectory(path)) |
| 328 | return false; |
| 329 | break; |
| 330 | } |
| 331 | default: return false; |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | return true; |
| 337 | } |
| 338 | |
| 339 | unsigned Platform::CpuCores() |
| 340 | { |
no test coverage detected