From e448cc68b52dfbe0e994603b2e449a0e680ccde7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 24 May 2020 21:23:49 +0200 Subject: [PATCH] Import project: Speed up if --file-filter has been provided --- lib/importproject.cpp | 16 ++++++++++------ lib/importproject.h | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 161d6b19b..0a495ef54 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -200,11 +200,11 @@ ImportProject::Type ImportProject::import(const std::string &filename, Settings importCompileCommands(fin); return ImportProject::Type::COMPILE_DB; } else if (endsWith(filename, ".sln", 4)) { - importSln(fin,mPath); + importSln(fin, mPath, settings->fileFilter); return ImportProject::Type::VS_SLN; } else if (endsWith(filename, ".vcxproj", 8)) { std::map variables; - importVcxproj(filename, variables, emptyString); + importVcxproj(filename, variables, emptyString, settings->fileFilter); return ImportProject::Type::VS_VCXPROJ; } else if (endsWith(filename, ".bpr", 4)) { importBcb6Prj(filename); @@ -401,7 +401,7 @@ void ImportProject::importCompileCommands(std::istream &istr) } } -void ImportProject::importSln(std::istream &istr, const std::string &path) +void ImportProject::importSln(std::istream &istr, const std::string &path, const std::string &fileFilter) { std::map variables; variables["SolutionDir"] = path; @@ -419,7 +419,7 @@ void ImportProject::importSln(std::istream &istr, const std::string &path) std::string vcxproj(line.substr(pos1+1, pos-pos1+7)); if (!Path::isAbsolute(vcxproj)) vcxproj = path + vcxproj; - importVcxproj(Path::fromNativeSeparators(vcxproj), variables, emptyString); + importVcxproj(Path::fromNativeSeparators(vcxproj), variables, emptyString, fileFilter); } } @@ -602,7 +602,7 @@ static void loadVisualStudioProperties(const std::string &props, std::map &variables, const std::string &additionalIncludeDirectories) +void ImportProject::importVcxproj(const std::string &filename, std::map &variables, const std::string &additionalIncludeDirectories, const std::string &fileFilter) { variables["ProjectDir"] = Path::simplifyPath(Path::getPathFromFilename(filename)); @@ -661,6 +661,10 @@ void ImportProject::importVcxproj(const std::string &filename, std::map &variables, const std::string &additionalIncludeDirectories); + void importSln(std::istream &istr, const std::string &path, const std::string &fileFilter); + void importVcxproj(const std::string &filename, std::map &variables, const std::string &additionalIncludeDirectories, const std::string &fileFilter); void importBcb6Prj(const std::string &projectFilename); std::string mPath;