| 134 | }; |
| 135 | |
| 136 | void 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 | |
| 175 | void FileFinder::findFiles(const QString& dirPath, int depth, QList<QUrl>& results) |
| 176 | { |
no test coverage detected