关于cocos2d-x 2.14 删除fullPathFromRelativePath 的解决办法
参考发现网上的代码时发现
CCFileUtils::fullPathFromRelativePath("");
cocos2d::CCFileUtils" 没有成员 "fullPathFromRelativePath"
后来看帖有人提出2.x版本该方法不再是静态的故应使用
CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("");调用
但是依旧是上面的错误。突然想起最近使用
CCTextureCache::sharedTextureCache()->addImageAsync()时参数是相对路径
顾跟踪代码到CCTextureCache.cpp中发现以下代码段
看来这个方法真的是被取消了,故得到解决方案:
std::string pathKey = "test.xml";
pathKey = CCFileUtils::sharedFileUtils()->fullPathForFilename(pathKey.c_str());
TiXmlDocument* xmlDoc = new TiXmlDocument(pathKey.c_str());