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