MCPcopy Create free account
hub / github.com/comaps/comaps / MkDirRecursively

Method MkDirRecursively

libs/platform/platform.cpp:311–337  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

309
310// static
311bool 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
339unsigned Platform::CpuCores()
340{

Callers 3

DecompressZipArchiveFunction · 0.80

Calls 4

GetNativeSeparatorFunction · 0.85
JoinPathFunction · 0.85
TokenizeFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected