GUI: Only check current platform when checking sln/vcxproj file

This commit is contained in:
Daniel Marjamäki 2016-08-20 13:47:25 +02:00
parent 9cced993aa
commit fe2fa4d343
3 changed files with 15 additions and 1 deletions

View File

@ -373,7 +373,6 @@ void MainWindow::DoCheckProject(ImportProject p)
mUI.mResults->CheckingStarted(p.fileSettings.size());
mThread->SetProject(p);
QDir inf(mCurrentDirectory);
const QString checkPath = inf.canonicalPath();
SetPath(SETTINGS_LAST_CHECK_PATH, checkPath);
@ -384,10 +383,14 @@ void MainWindow::DoCheckProject(ImportProject p)
Settings checkSettings = GetCppcheckSettings();
checkSettings.force = false;
if (checkSettings.isWindowsPlatform())
p.ignoreOtherPlatforms(checkSettings.platformType);
if (mProject)
qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename();
//mThread->SetCheckProject(true);
mThread->SetProject(p);
mThread->Check(checkSettings, true);
}

View File

@ -43,6 +43,16 @@ void ImportProject::ignorePaths(std::vector<std::string> &ipaths)
}
}
void ImportProject::ignoreOtherPlatforms(cppcheck::Platform::PlatformType platformType)
{
for (std::list<FileSettings>::iterator it = fileSettings.begin(); it != fileSettings.end();) {
if (it->platformType != cppcheck::Platform::Unspecified && it->platformType != platformType)
fileSettings.erase(it++);
else
++it;
}
}
void ImportProject::FileSettings::setDefines(std::string defs)
{
while (defs.find(";%(") != std::string::npos) {

View File

@ -52,6 +52,7 @@ public:
std::list<FileSettings> fileSettings;
void ignorePaths(std::vector<std::string> &ipaths);
void ignoreOtherPlatforms(cppcheck::Platform::PlatformType platformType);
void import(const std::string &filename);
private: