MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / gatherSearchFiles

Function gatherSearchFiles

app/src/AI/FileSandbox.cpp:499–520  ·  view source on GitHub ↗

* @brief Walks the read roots, collecting files to search within the scan cap. */

Source from the content-addressed store, hash-verified

497 * @brief Walks the read roots, collecting files to search within the scan cap.
498 */
499static QStringList gatherSearchFiles(const QStringList& roots, int cap)
500{
501 QStringList files;
502 for (const auto& root : roots) {
503 const QFileInfo rootInfo(root);
504 if (rootInfo.isFile()) {
505 files.append(root);
506 continue;
507 }
508
509 QDirIterator it(root,
510 QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden | QDir::NoSymLinks,
511 QDirIterator::Subdirectories);
512 while (it.hasNext() && files.size() < cap)
513 files.append(it.next());
514
515 if (files.size() >= cap)
516 break;
517 }
518
519 return files;
520}
521
522/**
523 * @brief Grep-like content search across the read roots; literal or regex.

Callers 1

searchMethod · 0.85

Calls 3

nextMethod · 0.80
appendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected