[jOOQ/jOOQ#9726] FilePattern matches too many files when wildcards are
being used
This commit is contained in:
parent
025fc98685
commit
8baac33263
@ -222,19 +222,16 @@ public final class FilePattern {
|
||||
load(file, comparator, null, loader);
|
||||
loaded = true;
|
||||
}
|
||||
else if (!pattern.contains("*") && !pattern.contains("?")) {
|
||||
load(new File(basedir, pattern), comparator, null, loader);
|
||||
loaded = true;
|
||||
}
|
||||
else {
|
||||
String prefix = pattern.replaceAll("[*?].*", "");
|
||||
File canonical = new File(prefix).getCanonicalFile();
|
||||
|
||||
// [#8336] Relative paths aren't necessarily relative to the
|
||||
// working directory, but maybe to some subdirectory
|
||||
if (pattern.contains("*") || pattern.contains("?")) {
|
||||
String prefix = pattern.replaceAll("[*?].*", "");
|
||||
File canonical = new File(prefix).getCanonicalFile();
|
||||
|
||||
if (canonical.exists())
|
||||
file = canonical;
|
||||
else
|
||||
file = new File(basedir, prefix);
|
||||
}
|
||||
if (canonical.exists())
|
||||
file = canonical;
|
||||
else
|
||||
file = basedir.getCanonicalFile();
|
||||
|
||||
@ -291,11 +288,6 @@ public final class FilePattern {
|
||||
load(f, comparator, regex, loader);
|
||||
}
|
||||
}
|
||||
|
||||
// [#7767] Backtrack to a parent directory in case the current file pattern doesn't match yet
|
||||
else if (!file.exists() && file.getParentFile() != null) {
|
||||
load(file.getParentFile(), comparator, regex, loader);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user