@@ -12,12 +12,10 @@ interface FileMatch {
|
|||||||
function searchDirectoryRecursive(
|
function searchDirectoryRecursive(
|
||||||
dir: string,
|
dir: string,
|
||||||
pattern: string,
|
pattern: string,
|
||||||
maxDepth: number = 3,
|
maxResults: number = 200,
|
||||||
currentDepth: number = 0,
|
|
||||||
maxResults: number = 100,
|
|
||||||
results: FileMatch[] = [],
|
results: FileMatch[] = [],
|
||||||
): FileMatch[] {
|
): FileMatch[] {
|
||||||
if (currentDepth > maxDepth || results.length >= maxResults) {
|
if (results.length >= maxResults) {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,14 +59,7 @@ function searchDirectoryRecursive(
|
|||||||
|
|
||||||
// Recursively search subdirectories
|
// Recursively search subdirectories
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
searchDirectoryRecursive(
|
searchDirectoryRecursive(fullPath, pattern, maxResults, results);
|
||||||
fullPath,
|
|
||||||
pattern,
|
|
||||||
maxDepth,
|
|
||||||
currentDepth + 1,
|
|
||||||
maxResults,
|
|
||||||
results,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
@@ -116,9 +107,7 @@ export async function searchFiles(
|
|||||||
const deepResults = searchDirectoryRecursive(
|
const deepResults = searchDirectoryRecursive(
|
||||||
searchDir,
|
searchDir,
|
||||||
searchPattern,
|
searchPattern,
|
||||||
3, // Max depth of 3 levels
|
200, // Max 200 results (no depth limit - will search all nested directories)
|
||||||
0,
|
|
||||||
100, // Max 100 results
|
|
||||||
);
|
);
|
||||||
results.push(...deepResults);
|
results.push(...deepResults);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user