fixed search
This commit is contained in:
parent
65a996bc29
commit
d30944ebec
@ -658,16 +658,20 @@ public class FileOperations {
|
||||
for (File file : files) {
|
||||
if (callback != null && callback.isCancelled()) return;
|
||||
try {
|
||||
if (file.isDirectory()) {
|
||||
if (maxDepth == -1 || currentDepth < maxDepth) {
|
||||
searchRecursive(file, patternLower, filenameRegex, contentPattern, maxDepth, currentDepth + 1, searchArchives, caseSensitive, callback);
|
||||
}
|
||||
} else {
|
||||
// Always check if current file/directory matches name pattern
|
||||
boolean nameMatched = true;
|
||||
if (patternLower != null && !patternLower.isEmpty()) {
|
||||
nameMatched = matchName(file.getName(), patternLower, filenameRegex, caseSensitive);
|
||||
}
|
||||
|
||||
if (file.isDirectory()) {
|
||||
if (nameMatched && (contentPattern == null)) {
|
||||
callback.onFileFound(file, null);
|
||||
}
|
||||
if (maxDepth == -1 || currentDepth < maxDepth) {
|
||||
searchRecursive(file, patternLower, filenameRegex, contentPattern, maxDepth, currentDepth + 1, searchArchives, caseSensitive, callback);
|
||||
}
|
||||
} else {
|
||||
boolean contentMatched = true;
|
||||
if (nameMatched && contentPattern != null) {
|
||||
contentMatched = fileMatchesContent(file, contentPattern);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user