From 33ff346d3beffb00c369ec237ae2619993ade684 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Wed, 19 Apr 2017 14:03:10 +0200 Subject: [PATCH] logic: Fixed refresh not recognizing added files --- src/lib/project/Project.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/project/Project.cpp b/src/lib/project/Project.cpp index 7e8f6719..6e7fd3e1 100644 --- a/src/lib/project/Project.cpp +++ b/src/lib/project/Project.cpp @@ -283,6 +283,7 @@ bool Project::requestIndex(bool forceRefresh, bool needsFullRefresh) } std::set filesToClean; + std::set filesToAdd; if (!needsFullRefresh) { std::set unchangedFilePaths; @@ -315,13 +316,13 @@ bool Project::requestIndex(bool forceRefresh, bool needsFullRefresh) // handle referencing paths utility::append(filesToClean, m_storage->getReferencing(changedFilePaths)); - // handle referenced paths std::set staticSourceFiles = allSourceFilePaths; for (const FilePath& path: changedFilePaths) { staticSourceFiles.erase(path); } + const std::set staticReferencedFilePaths = m_storage->getReferenced(staticSourceFiles); const std::set dynamicReferencedFilePaths = m_storage->getReferenced(changedFilePaths); @@ -334,12 +335,18 @@ bool Project::requestIndex(bool forceRefresh, bool needsFullRefresh) filesToClean.insert(path); } } + + for (const FilePath& path: unchangedFilePaths) + { + staticSourceFiles.erase(path); + } + filesToAdd = staticSourceFiles; } std::set staticSourceFilePaths; for (const FilePath& path: allSourceFilePaths) { - if (filesToClean.find(path) == filesToClean.end()) + if (filesToClean.find(path) == filesToClean.end() && filesToAdd.find(path) == filesToAdd.end()) { staticSourceFilePaths.insert(path); }