| 129 | } |
| 130 | |
| 131 | void FileSearchUtils::searchInFileSystem( |
| 132 | const QString &dirPath, |
| 133 | const QString &query, |
| 134 | const QString &projectName, |
| 135 | const QString &projectDir, |
| 136 | ProjectExplorer::Project *project, |
| 137 | QList<FileMatch> &matches, |
| 138 | int maxResults, |
| 139 | int ¤tDepth, |
| 140 | int maxDepth, |
| 141 | Context::IgnoreManager *ignoreManager) |
| 142 | { |
| 143 | if (currentDepth >= maxDepth || matches.size() >= maxResults) |
| 144 | return; |
| 145 | |
| 146 | currentDepth++; |
| 147 | QDir dir(dirPath); |
| 148 | if (!dir.exists()) { |
| 149 | currentDepth--; |
| 150 | return; |
| 151 | } |
| 152 | |
| 153 | auto entries = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); |
| 154 | for (const auto &entry : entries) { |
| 155 | if (matches.size() >= maxResults) |
| 156 | break; |
| 157 | |
| 158 | QString absolutePath = entry.absoluteFilePath(); |
| 159 | |
| 160 | if (ignoreManager && ignoreManager->shouldIgnore(absolutePath, project)) |
| 161 | continue; |
| 162 | |
| 163 | QString fileName = entry.fileName(); |
| 164 | |
| 165 | if (entry.isDir()) { |
| 166 | searchInFileSystem( |
| 167 | absolutePath, |
| 168 | query, |
| 169 | projectName, |
| 170 | projectDir, |
| 171 | project, |
| 172 | matches, |
| 173 | maxResults, |
| 174 | currentDepth, |
| 175 | maxDepth, |
| 176 | ignoreManager); |
| 177 | continue; |
| 178 | } |
| 179 | |
| 180 | QString lowerFileName = fileName.toLower(); |
| 181 | QString relativePath = QDir(projectDir).relativeFilePath(absolutePath); |
| 182 | QString lowerRelativePath = relativePath.toLower(); |
| 183 | |
| 184 | FileMatch match; |
| 185 | match.absolutePath = absolutePath; |
| 186 | match.relativePath = relativePath; |
| 187 | match.projectName = projectName; |
| 188 |
nothing calls this directly
no test coverage detected