| 68 | } |
| 69 | |
| 70 | QStringList scanIncludePaths( const QString& identifier, const QDir& dir, int maxDepth = 3 ) |
| 71 | { |
| 72 | if (!maxDepth) { |
| 73 | return {}; |
| 74 | } |
| 75 | |
| 76 | QStringList candidates; |
| 77 | const auto path = dir.absolutePath(); |
| 78 | |
| 79 | if( isBlacklisted( path ) ) { |
| 80 | return {}; |
| 81 | } |
| 82 | |
| 83 | const QStringList nameFilters = {identifier, identifier + QLatin1String(".*")}; |
| 84 | const auto& files = dir.entryList(nameFilters, QDir::Files); |
| 85 | for (const auto& file : files) { |
| 86 | if (identifier.compare(file, Qt::CaseInsensitive) == 0 || ClangHelpers::isHeader(file)) { |
| 87 | const QString filePath = path + QLatin1Char('/') + file; |
| 88 | clangDebug() << "Found candidate file" << filePath; |
| 89 | candidates.append( filePath ); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | maxDepth--; |
| 94 | const auto& subdirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); |
| 95 | for (const auto& subdir : subdirs) { |
| 96 | candidates += scanIncludePaths( identifier, QDir{ path + QLatin1Char('/') + subdir }, maxDepth ); |
| 97 | } |
| 98 | |
| 99 | return candidates; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Find files in dir that match the given identifier. Matches common C++ header file extensions only. |
no test coverage detected