1140 auto s = Director::getInstance()->getWinSize();
1141 auto sharedFileUtils = FileUtils::getInstance();
1146 std::string filename =
"__test.test";
1147 std::string filename2 =
"__newtest.test";
1148 std::string filepath = sharedFileUtils->getWritablePath() + filename;
1149 std::string content =
"Test string content to put into created file";
1152 FILE *out = fopen(filepath.c_str(),
"w");
1153 fputs(content.c_str(), out);
1157 sharedFileUtils->isFileExist(filepath, [=](
bool exists) {
1158 CCASSERT(exists,
"File could not be found");
1159 auto label = Label::createWithSystemFont(
"Test file '__test.test' created",
"", 20);
1160 label->setPosition(x, y * 4);
1161 this->addChild(label);
1163 sharedFileUtils->getFileSize(filepath, [=](
long size) {
1164 auto msg = StringUtils::format(
"getFileSize: Test file size equals %ld", size);
1165 auto label = Label::createWithSystemFont(msg,
"", 20);
1166 label->setPosition(x, y * 3);
1167 this->addChild(label);
1169 sharedFileUtils->renameFile(sharedFileUtils->getWritablePath(), filename, filename2, [=] (
bool success) {
1170 CCASSERT(success,
"Was not able to properly rename file");
1171 auto label = Label::createWithSystemFont(
"renameFile: Test file renamed to '__newtest.test'",
"", 20);
1172 label->setPosition(x, y * 2);
1173 this->addChild(label);
1175 sharedFileUtils->removeFile(sharedFileUtils->getWritablePath() + filename2, [=](bool success) {
1176 CCASSERT(success,
"Was not able to remove file");
1177 auto label = Label::createWithSystemFont(
"removeFile: Test file removed",
"", 20);
1178 label->setPosition(x, y * 1);
1179 this->addChild(label);
virtual void onEnter() override