platform.cpp: Fix that platform files on Windows are not found (#1096)

* platform.cpp: Fix that platform files on Windows are not found

I suggested this change here:
https://trac.cppcheck.net/ticket/8242#comment:7

* Use fromNativeSeparators() and only search for forwardslash
This commit is contained in:
Sebastian 2018-02-26 13:51:02 +01:00 committed by amai2012
parent defb74c0fe
commit 54d1490c89
1 changed files with 1 additions and 1 deletions

View File

@ -161,7 +161,7 @@ bool cppcheck::Platform::platformFile(const char exename[], const std::string &f
if (doc.LoadFile(filename.c_str()) != tinyxml2::XML_SUCCESS) {
std::vector<std::string> filenames;
filenames.push_back(filename + ".xml");
if (exename && strchr(exename, '/')) {
if (exename && (std::string::npos != Path::fromNativeSeparators(exename).find('/'))) {
filenames.push_back(Path::getPathFromFilename(Path::fromNativeSeparators(exename)) + "platforms/" + filename);
filenames.push_back(Path::getPathFromFilename(Path::fromNativeSeparators(exename)) + "platforms/" + filename + ".xml");
}