logic: add contained symlinked directories to indexed and excluded paths
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "utility/file/FileManager.h"
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
|
||||
SourceGroup::~SourceGroup()
|
||||
{
|
||||
@@ -28,8 +29,8 @@ void SourceGroup::fetchAllSourceFilePaths()
|
||||
m_sourceFilePathsToIndex.clear();
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
getAllSourcePaths(),
|
||||
getSourceGroupSettings()->getExcludePathsExpandedAndAbsolute(),
|
||||
getAllSourcePaths(),
|
||||
getSourceGroupSettings()->getExcludePathsExpandedAndAbsolute(),
|
||||
getSourceGroupSettings()->getSourceExtensions()
|
||||
);
|
||||
m_allSourceFilePaths = fileManager.getAllSourceFilePaths();
|
||||
@@ -46,6 +47,16 @@ void SourceGroup::fetchSourceFilePathsToIndex(const std::set<FilePath>& staticSo
|
||||
}
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::getIndexedPaths()
|
||||
{
|
||||
return findAndAddSymlinkedDirectories(getSourceGroupSettings()->getSourcePathsExpandedAndAbsolute());
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::getExcludedPaths()
|
||||
{
|
||||
return findAndAddSymlinkedDirectories(getSourceGroupSettings()->getExcludePathsExpandedAndAbsolute());
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::getAllSourceFilePaths() const
|
||||
{
|
||||
return m_allSourceFilePaths;
|
||||
@@ -55,3 +66,20 @@ std::set<FilePath> SourceGroup::getSourceFilePathsToIndex() const
|
||||
{
|
||||
return m_sourceFilePathsToIndex;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroup::findAndAddSymlinkedDirectories(const std::vector<FilePath>& paths)
|
||||
{
|
||||
std::set<FilePath> resultPaths;
|
||||
for (const FilePath& path: paths)
|
||||
{
|
||||
if (path.exists())
|
||||
{
|
||||
resultPaths.insert(path);
|
||||
}
|
||||
}
|
||||
|
||||
std::set<FilePath> symLinkPaths = FileSystem::getSymLinkedDirectories(paths);
|
||||
resultPaths.insert(symLinkPaths.begin(), symLinkPaths.end());
|
||||
|
||||
return resultPaths;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user