| 284 | } |
| 285 | |
| 286 | void GrepFindFilesThread::run() |
| 287 | { |
| 288 | Q_D(GrepFindFilesThread); |
| 289 | |
| 290 | const QStringList include = GrepFindFilesThread::parseInclude(d->m_patString); |
| 291 | const QStringList exclude = GrepFindFilesThread::parseExclude(d->m_exclString); |
| 292 | |
| 293 | qCDebug(PLUGIN_GREPVIEW) << "running with start dir" << d->m_startDirs; |
| 294 | |
| 295 | FileFinder finder(include, exclude, d->m_tryAbort); |
| 296 | // m_projectFileSets contains a project file set for each element of m_startDirs at a |
| 297 | // corresponding index if this search is limited to project files; is empty otherwise. |
| 298 | Q_ASSERT(d->m_projectFileSets.empty() || |
| 299 | d->m_projectFileSets.size() == static_cast<std::size_t>(d->m_startDirs.size())); |
| 300 | for (const QUrl& directory : d->m_startDirs) { |
| 301 | if (d->m_projectFileSets.empty()) { |
| 302 | finder.findFiles(directory.toLocalFile(), d->m_depth, d->m_files); |
| 303 | } else { |
| 304 | finder.getProjectFiles(d->m_projectFileSets.front(), directory, d->m_depth, d->m_files); |
| 305 | // Removing the no longer needed file set from the collection as |
| 306 | // soon as possible may save some memory or prevent a copy on write |
| 307 | // if the project's file set is changed during the search. |
| 308 | d->m_projectFileSets.pop(); |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | QList<QUrl> GrepFindFilesThread::takeFiles() |
| 314 | { |