| 319 | } |
| 320 | |
| 321 | QList<QString> Comic::findValidComicFilesInFolder(const QString &path) |
| 322 | { |
| 323 | QLOG_DEBUG() << "-findValidComicFilesInFolder-" << path; |
| 324 | |
| 325 | if (!QFileInfo(path).isDir()) |
| 326 | return QList<QString>(); |
| 327 | |
| 328 | QList<QString> validComicFiles; |
| 329 | QDir folder(path); |
| 330 | folder.setNameFilters(Comic::comicExtensions); |
| 331 | folder.setFilter(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot); |
| 332 | QFileInfoList folderContent = folder.entryInfoList(); |
| 333 | |
| 334 | QString currentPath; |
| 335 | for (const QFileInfo &info : std::as_const(folderContent)) { |
| 336 | currentPath = info.absoluteFilePath(); |
| 337 | if (info.isDir()) { |
| 338 | validComicFiles << findValidComicFilesInFolder(currentPath); // find comics recursively |
| 339 | } else if (Comic::fileIsComic(currentPath)) { |
| 340 | validComicFiles << currentPath; |
| 341 | } |
| 342 | } |
| 343 | return validComicFiles; |
| 344 | } |
| 345 | |
| 346 | //////////////////////////////////////////////////////////////////////////////// |
| 347 | //////////////////////////////////////////////////////////////////////////////// |