Platform: Fix CFGDIR handling
This commit is contained in:
parent
3c00a22c42
commit
f5b91ffca8
lib
|
@ -23,7 +23,6 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
cppcheck::Platform::Platform()
|
cppcheck::Platform::Platform()
|
||||||
{
|
{
|
||||||
|
@ -168,14 +167,13 @@ bool cppcheck::Platform::platformFile(const char exename[], const std::string &f
|
||||||
}
|
}
|
||||||
#ifdef CFGDIR
|
#ifdef CFGDIR
|
||||||
std::string cfgdir = CFGDIR;
|
std::string cfgdir = CFGDIR;
|
||||||
if (cfgdir[cfgdir.size()-1] != '/')
|
if (!cfgdir.empty() && 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;
|
|
||||||
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;
|
||||||
|
|
Loading…
Reference in New Issue