@@ -200,11 +200,11 @@ ImportProject::Type ImportProject::import(const std::string &filename, Settings
200200 importCompileCommands (fin);
201201 return ImportProject::Type::COMPILE_DB;
202202 } else if (endsWith (filename, " .sln" , 4 )) {
203- importSln (fin,mPath );
203+ importSln (fin, mPath , settings-> fileFilter );
204204 return ImportProject::Type::VS_SLN;
205205 } else if (endsWith (filename, " .vcxproj" , 8 )) {
206206 std::map<std::string, std::string, cppcheck::stricmp> variables;
207- importVcxproj (filename, variables, emptyString);
207+ importVcxproj (filename, variables, emptyString, settings-> fileFilter );
208208 return ImportProject::Type::VS_VCXPROJ;
209209 } else if (endsWith (filename, " .bpr" , 4 )) {
210210 importBcb6Prj (filename);
@@ -401,7 +401,7 @@ void ImportProject::importCompileCommands(std::istream &istr)
401401 }
402402}
403403
404- void ImportProject::importSln (std::istream &istr, const std::string &path)
404+ void ImportProject::importSln (std::istream &istr, const std::string &path, const std::string &fileFilter )
405405{
406406 std::map<std::string,std::string,cppcheck::stricmp> variables;
407407 variables[" SolutionDir" ] = path;
@@ -419,7 +419,7 @@ void ImportProject::importSln(std::istream &istr, const std::string &path)
419419 std::string vcxproj (line.substr (pos1+1 , pos-pos1+7 ));
420420 if (!Path::isAbsolute (vcxproj))
421421 vcxproj = path + vcxproj;
422- importVcxproj (Path::fromNativeSeparators (vcxproj), variables, emptyString);
422+ importVcxproj (Path::fromNativeSeparators (vcxproj), variables, emptyString, fileFilter );
423423 }
424424}
425425
@@ -602,7 +602,7 @@ static void loadVisualStudioProperties(const std::string &props, std::map<std::s
602602 }
603603}
604604
605- void ImportProject::importVcxproj (const std::string &filename, std::map<std::string, std::string, cppcheck::stricmp> &variables, const std::string &additionalIncludeDirectories)
605+ void ImportProject::importVcxproj (const std::string &filename, std::map<std::string, std::string, cppcheck::stricmp> &variables, const std::string &additionalIncludeDirectories, const std::string &fileFilter )
606606{
607607 variables[" ProjectDir" ] = Path::simplifyPath (Path::getPathFromFilename (filename));
608608
@@ -661,6 +661,10 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
661661 }
662662
663663 for (const std::string &c : compileList) {
664+ const std::string cfilename = Path::simplifyPath (Path::isAbsolute (c) ? c : Path::getPathFromFilename (filename) + c);
665+ if (!fileFilter.empty () && !matchglob (fileFilter, cfilename))
666+ continue ;
667+
664668 for (const ProjectConfiguration &p : projectConfigurationList) {
665669
666670 if (!guiProject.checkVsConfigs .empty ()) {
@@ -675,7 +679,7 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
675679 }
676680
677681 FileSettings fs;
678- fs.filename = Path::simplifyPath ( Path::isAbsolute (c) ? c : Path::getPathFromFilename (filename) + c) ;
682+ fs.filename = cfilename ;
679683 fs.cfg = p.name ;
680684 fs.msc = true ;
681685 fs.useMfc = useOfMfc;
0 commit comments