MCPcopy Create free account
hub / github.com/KDE/kdevelop / getProjectFiles

Method getProjectFiles

plugins/grepview/grepfindthread.cpp:136–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134};
135
136void FileFinder::getProjectFiles(const QSet<IndexedString>& projectFileSet,
137 const QUrl& dir, int depth, QList<QUrl>& results)
138{
139 // Cannot use dir.adjusted(QUrl::StripTrailingSlash) here, because it does not
140 // remove the single slash of the root directory. Both isInDirectory() and
141 // removeDirectoryPrefix() require the empty-string representation of the root directory.
142 const auto dirPath = removeTrailingSlashes(dir.path());
143
144 for (const IndexedString& item : projectFileSet) {
145 if (shouldAbort()) {
146 break;
147 }
148 QUrl url = item.toUrl();
149 // The scheme and authority of url match those of dir, because
150 // both belong to a common project (see getProjectFileSets() below).
151 auto urlPath = url.path();
152
153 if (urlPath == dirPath) {
154 // Do not match against filters, because this particular URL is a search location.
155 results.push_back(std::move(url));
156 continue;
157 }
158
159 if (!isInDirectory(urlPath, dirPath, depth)) {
160 continue;
161 }
162
163 const auto urlFileName = urlPath.mid(urlPath.lastIndexOf(QLatin1Char{'/'}) + 1);
164 if (!QDir::match(m_include, urlFileName)) {
165 continue;
166 }
167
168 const auto relativeFilePath = removeDirectoryPrefix(std::move(urlPath), dirPath);
169 if (!WildcardHelpers::match(m_exclude, relativeFilePath)) {
170 results.push_back(std::move(url));
171 }
172 }
173}
174
175void FileFinder::findFiles(const QString& dirPath, int depth, QList<QUrl>& results)
176{

Callers 1

runMethod · 0.80

Calls 8

removeTrailingSlashesFunction · 0.85
isInDirectoryFunction · 0.85
removeDirectoryPrefixFunction · 0.85
midMethod · 0.80
matchFunction · 0.50
pathMethod · 0.45
toUrlMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected