modify Assets.loadStrings, strings file can be nnywhere in pak

This commit is contained in:
侯歌 2024-05-09 10:40:11 +08:00
parent 272733716b
commit 606e073325

View File

@ -297,10 +297,16 @@ std::unique_ptr<std::istream> Assets::getInputStream(const std::string&fullresid
}
void Assets::loadStrings(const std::string&lan) {
const std::string suffix = "/strings-"+lan+".xml";
for(auto a:mResources) {
const std::string fname = "strings/strings-"+lan+".xml";
loadKeyValues(fname,nullptr,std::bind(&Assets::parseItem,this,a.first,fname,std::placeholders::_1,
std::placeholders::_2,std::placeholders::_3,std::placeholders::_4));
std::vector<std::string>files;
a.second->getEntries(files);
for(auto fileName:files){
if( (TextUtils::endWith(fileName,".xml") && TextUtils::endWith(fileName,suffix) )==false)continue;
loadKeyValues(fileName,nullptr,std::bind(&Assets::parseItem,this,a.first,fileName,std::placeholders::_1,
std::placeholders::_2,std::placeholders::_3,std::placeholders::_4));
LOGD("load %s for '%s'",fileName.c_str(),lan.c_str());
}
}
}