cocos2dx3.13,FileUtils-android.cpp中可以看到:
FileUtils::Status FileUtilsAndroid::getContents(const std::string& filename, ResizableBuffer* buffer)
{
static const std::string apkprefix("assets/");
if (filename.empty())
return FileUtils::Status::NotExists;
string fullPath = fullPathForFilename(filename);
if (fullPath[0] == ‘/‘)
return FileUtils::getContents(fullPath, buffer);
string relativePath = string();
size_t position = fullPath.find(apkprefix);
if (0 == position) {
// "assets/" is at the beginning of the path and we don‘t want it
relativePath += fullPath.substr(apkprefix.size());
} else {
relativePath = fullPath;
}
...
}
如果路径以assets/开头,则assets会被去掉。这就意味着你的Resources下不能有assets文件夹,否则下面所有的文件都会由于这个规则而无法取到。
记录一下
原文:http://www.cnblogs.com/eaglelun/p/6160919.html