434 auto s = Director::getInstance()->getWinSize();
435 auto sharedFileUtils = FileUtils::getInstance();
439 Label* label =
nullptr;
441 std::string dir = sharedFileUtils->getWritablePath() +
"__test";
442 std::string subDir =
"dir1/dir2";
443 std::string fullSubDir = dir +
"/" + subDir;
448 ok = sharedFileUtils->createDirectory(dir);
449 if (ok && sharedFileUtils->isDirectoryExist(dir))
451 msg = StringUtils::format(
"createDirectory: Directory '__test' created");
452 label = Label::createWithSystemFont(msg,
"", 20);
453 label->setPosition(x, y * 3);
454 this->addChild(label);
457 ok = sharedFileUtils->createDirectory(fullSubDir);
458 if (ok && sharedFileUtils->isDirectoryExist(fullSubDir))
460 msg = StringUtils::format(
"createDirectory: Sub directories '%s' created", subDir.c_str());
461 label = Label::createWithSystemFont(msg,
"", 20);
462 label->setPosition(x, y * 2);
463 this->addChild(label);
467 msg = StringUtils::format(
"createDirectory: Failed to create sub directories '%s'", subDir.c_str());
468 label = Label::createWithSystemFont(msg,
"", 20);
469 label->setPosition(x, y * 2);
470 this->addChild(label);
474 ok = sharedFileUtils->removeDirectory(dir);
475 if (ok && !sharedFileUtils->isDirectoryExist(dir))
477 msg = StringUtils::format(
"removeDirectory: Directory '__test' removed");
478 label = Label::createWithSystemFont(msg,
"", 20);
479 label->setPosition(x, y);
480 this->addChild(label);
484 msg = StringUtils::format(
"removeDirectory: Failed to remove directory '__test'");
485 label = Label::createWithSystemFont(msg,
"", 20);
486 label->setPosition(x, y);
487 this->addChild(label);
492 msg = StringUtils::format(
"createDirectory: Directory '__test' can not be created");
493 label = Label::createWithSystemFont(msg,
"", 20);
494 label->setPosition(x, y * 2);
495 this->addChild(label);
virtual void onEnter() override