| 419 | } |
| 420 | |
| 421 | bool collectFileListRecursively(const QString& rootDir, const QString& subDir, QFileInfoList* files, FilterFunction excludeFilter) |
| 422 | { |
| 423 | QDir rootDirectory(rootDir); |
| 424 | if (!rootDirectory.exists()) |
| 425 | return false; |
| 426 | |
| 427 | QDir directory; |
| 428 | if (subDir == nullptr) |
| 429 | directory = rootDirectory; |
| 430 | else |
| 431 | directory = QDir(subDir); |
| 432 | |
| 433 | if (!directory.exists()) |
| 434 | return false; // shouldn't ever happen |
| 435 | |
| 436 | // recurse directories |
| 437 | QFileInfoList entries = directory.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Hidden); |
| 438 | for (const auto& e : entries) { |
| 439 | if (!collectFileListRecursively(rootDir, e.filePath(), files, excludeFilter)) |
| 440 | return false; |
| 441 | } |
| 442 | |
| 443 | // collect files |
| 444 | entries = directory.entryInfoList(QDir::Files); |
| 445 | for (const auto& e : entries) { |
| 446 | QString relativeFilePath = rootDirectory.relativeFilePath(e.absoluteFilePath()); |
| 447 | if (excludeFilter && excludeFilter(relativeFilePath)) { |
| 448 | qDebug() << "Skipping file " << relativeFilePath; |
| 449 | continue; |
| 450 | } |
| 451 | |
| 452 | files->append(e); // we want the original paths for compressDirFiles |
| 453 | } |
| 454 | return true; |
| 455 | } |
| 456 | |
| 457 | #if defined(LAUNCHER_APPLICATION) |
| 458 | void ExportToZipTask::executeTask() |
no test coverage detected