parent
9eb6d38c06
commit
7c33207a72
|
@ -160,30 +160,30 @@ bool cppcheck::Platform::platformFile(const char exename[], const std::string &f
|
||||||
// open file..
|
// open file..
|
||||||
tinyxml2::XMLDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
if (doc.LoadFile(filename.c_str()) != tinyxml2::XML_SUCCESS) {
|
if (doc.LoadFile(filename.c_str()) != tinyxml2::XML_SUCCESS) {
|
||||||
std::vector<std::string> filenames;
|
std::vector<std::string> filenames;
|
||||||
filenames.push_back(filename + ".xml");
|
filenames.push_back(filename + ".xml");
|
||||||
if (exename && strchr(exename, '/')) {
|
if (exename && strchr(exename, '/')) {
|
||||||
filenames.push_back(Path::getPathFromFilename(Path::fromNativeSeparators(exename)) + "platforms/" + filename);
|
filenames.push_back(Path::getPathFromFilename(Path::fromNativeSeparators(exename)) + "platforms/" + filename);
|
||||||
filenames.push_back(Path::getPathFromFilename(Path::fromNativeSeparators(exename)) + "platforms/" + filename + ".xml");
|
filenames.push_back(Path::getPathFromFilename(Path::fromNativeSeparators(exename)) + "platforms/" + filename + ".xml");
|
||||||
}
|
}
|
||||||
#ifdef CFGDIR
|
#ifdef CFGDIR
|
||||||
std::string cfgdir = CFGDIR;
|
std::string cfgdir = CFGDIR;
|
||||||
if (cfgdir[cfgdir.size()-1] != '/')
|
if (cfgdir[cfgdir.size()-1] != '/')
|
||||||
cfgdir += '/';
|
cfgdir += '/';
|
||||||
filenames.push_back(CFGDIR + ("../platforms/" + filename));
|
filenames.push_back(CFGDIR + ("../platforms/" + filename));
|
||||||
filenames.push_back(CFGDIR + ("../platforms/" + filename + ".xml"));
|
filenames.push_back(CFGDIR + ("../platforms/" + filename + ".xml"));
|
||||||
#endif
|
#endif
|
||||||
bool success = false;
|
bool success = false;
|
||||||
for (int i = 0; i < filenames.size(); ++i) {
|
for (int i = 0; i < filenames.size(); ++i) {
|
||||||
std::cout << "platform:" << filenames[i] << std::endl;
|
std::cout << "platform:" << filenames[i] << std::endl;
|
||||||
if (doc.LoadFile(filenames[i].c_str()) == tinyxml2::XML_SUCCESS) {
|
if (doc.LoadFile(filenames[i].c_str()) == tinyxml2::XML_SUCCESS) {
|
||||||
success = true;
|
success = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!success)
|
if (!success)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
|
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue