mirror of https://github.com/axmolengine/axmol.git
[Android] fix FileUtils::listFiles with path 'assets/'
This commit is contained in:
parent
408f6cf9da
commit
195dc704e3
|
@ -300,7 +300,7 @@ long FileUtilsAndroid::getFileSize(const std::string& filepath) const
|
|||
std::vector<std::string> FileUtilsAndroid::listFiles(const std::string& dirPath) const
|
||||
{
|
||||
|
||||
if(isAbsolutePath(dirPath)) return FileUtils::listFiles(dirPath);
|
||||
if(!dirPath.empty() && dirPath[0] == '/') return FileUtils::listFiles(dirPath);
|
||||
|
||||
std::vector<std::string> fileList;
|
||||
string fullPath = fullPathForDirectory(dirPath);
|
||||
|
|
|
@ -1409,10 +1409,23 @@ void TestListFiles::onEnter()
|
|||
this->addChild(cntLabel);
|
||||
cntLabel->setPosition(winSize.width / 2, winSize.height / 3);
|
||||
// writeTest
|
||||
auto list = FileUtils::getInstance()->listFiles("fonts");
|
||||
std::vector<std::string> listFonts = FileUtils::getInstance()->listFiles("fonts");
|
||||
auto defaultPath = FileUtils::getInstance()->getDefaultResourceRootPath();
|
||||
std::vector<std::string> list = FileUtils::getInstance()->listFiles (defaultPath);
|
||||
|
||||
char cntBuffer[200] = { 0 };
|
||||
snprintf(cntBuffer, 200, "%lu", static_cast<unsigned long>(list.size()));
|
||||
snprintf(cntBuffer, 200, "'fonts/' %d, $defaultResourceRootPath %d",listFonts.size(), list.size());
|
||||
|
||||
for(int i=0;i<listFonts.size();i++)
|
||||
{
|
||||
CCLOG("fonts/ %d: \t %s", i, listFonts[i].c_str());
|
||||
}
|
||||
|
||||
for(int i=0;i<list.size();i++)
|
||||
{
|
||||
CCLOG("defResRootPath %d: \t %s", i, list[i].c_str());
|
||||
}
|
||||
|
||||
cntLabel->setString(cntBuffer);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue