ImportProject: Import excluded paths properly

This commit is contained in:
Daniel Marjamäki 2019-04-07 12:31:52 +02:00
parent c04cc02ee5
commit 111db91387
3 changed files with 6 additions and 4 deletions

View File

@ -546,6 +546,9 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
return false;
}
for (const std::string &i : mSettings->project.guiProject.excludedPaths)
mIgnoredPaths.emplace_back(i);
const std::string platform(mSettings->project.guiProject.platform);
if (platform == "win32A")

View File

@ -985,7 +985,6 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
(void)ProjectVersionAttrib;
std::list<std::string> paths;
std::list<std::string> excludePaths;
Settings temp;
for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) {
@ -1005,9 +1004,9 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
else if (strcmp(node->Name(), PathsElementName) == 0)
paths = readXmlStringList(node, PathName, PathNameAttrib);
else if (strcmp(node->Name(), ExcludeElementName) == 0)
excludePaths = readXmlStringList(node, ExcludePathName, ExcludePathNameAttrib);
guiProject.excludedPaths = readXmlStringList(node, ExcludePathName, ExcludePathNameAttrib);
else if (strcmp(node->Name(), IgnoreElementName) == 0)
excludePaths = readXmlStringList(node, IgnorePathName, IgnorePathNameAttrib);
guiProject.excludedPaths = readXmlStringList(node, IgnorePathName, IgnorePathNameAttrib);
else if (strcmp(node->Name(), LibrariesElementName) == 0)
guiProject.libraries = readXmlStringList(node, LibraryElementName, nullptr);
else if (strcmp(node->Name(), SuppressionsElementName) == 0) {
@ -1034,6 +1033,5 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
settings->userUndefs = temp.userUndefs;
for (const std::string &path : paths)
guiProject.pathNames.push_back(path);
settings->project.ignorePaths(std::vector<std::string>(excludePaths.begin(), excludePaths.end()));
return true;
}

View File

@ -86,6 +86,7 @@ public:
struct {
std::vector<std::string> pathNames;
std::list<std::string> libraries;
std::list<std::string> excludedPaths;
std::string projectFile;
std::string platform;
} guiProject;