From cbd782d0c18937a1f4c1c7e9a3f840aac2d6f8d7 Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Wed, 11 Apr 2018 12:46:03 +0200 Subject: [PATCH] logic: fixed logic to detect excluded files for refresh info --- src/lib/project/Project.cpp | 49 +++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/src/lib/project/Project.cpp b/src/lib/project/Project.cpp index 0253f4d4..614394f7 100644 --- a/src/lib/project/Project.cpp +++ b/src/lib/project/Project.cpp @@ -495,29 +495,48 @@ RefreshInfo Project::getRefreshInfoForUpdatedFiles() const std::set changedFilePaths; { - std::set indexedPaths; + std::set alreadyIndexedPaths; + + const std::vector fileInfos = m_storage->getFileInfoForAllFiles(); + for (const std::shared_ptr& sourceGroup : m_sourceGroups) { if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED) { - utility::append(indexedPaths, sourceGroup->getIndexedPaths()); - } - } - indexedPaths = utility::toSet(utility::getTopLevelPaths(utility::toVector(indexedPaths))); - - for (const FileInfo& info : m_storage->getFileInfoForAllFiles()) - { - bool isInIndexedPaths = false; - for (const FilePath& indexedPath : indexedPaths) - { - if (indexedPath == info.path || indexedPath.contains(info.path)) + for (const FileInfo& info : fileInfos) { - isInIndexedPaths = true; - break; + bool isInIndexedPaths = false; + for (const FilePath& indexedPath : sourceGroup->getIndexedPaths()) + { + if (indexedPath == info.path || indexedPath.contains(info.path)) + { + isInIndexedPaths = true; + break; + } + } + if (isInIndexedPaths) + { + for (const FilePathFilter& excludeFilter : sourceGroup->getExcludeFilters()) + { + if (excludeFilter.isMatching(info.path)) + { + isInIndexedPaths = false; + break; + } + } + } + if (isInIndexedPaths) + { + alreadyIndexedPaths.insert(info.path); + } } } + } - if (isInIndexedPaths && info.path.exists()) + // checking source and header files + for (const FileInfo& info : fileInfos) + { + if (alreadyIndexedPaths.find(info.path) != alreadyIndexedPaths.end() && info.path.exists()) { if (didFileChange(info)) {