private static Set<File> getMatchingDirs(String pattern, Path dir) throws IOException { if (!StringUtils.isEmpty(pattern)) { // find all dirs and subdirs that match the pattern PathMatcher matcher = FileSystems.getDefault().getPathMatcher(getGlob(dir, pattern)); return new DirFinder().find(dir, matcher); } else { // no pattern, so we just return dir return Collections.singleton(dir.toFile()); } }
private static Set<File> getMatchingDirs(String pattern, Path dir) throws IOException { if (!StringUtils.isEmpty(pattern)) { // find all dirs and subdirs that match the pattern PathMatcher matcher = FileSystems.getDefault().getPathMatcher(getGlob(dir, pattern)); return new DirFinder().find(dir, matcher); } else { // no pattern, so we just return dir return Collections.singleton(dir.toFile()); } }
private static Set<File> getMatchingLibraries(String pattern, Path dir) throws IOException { Set<File> matches = new LinkedHashSet<>(); Set<File> dirs = getMatchingDirs(pattern, dir); PathMatcher matcher = FileSystems.getDefault().getPathMatcher(getGlob(dir, pattern)); for (File d : dirs) { matches.addAll(getLibs(d.toPath())); } matches.addAll(dirs); matches.addAll(new LibraryFinder().find(dir, matcher)); if(pattern.startsWith("**/")) { // match jar in the base dir when using wildcard matches.addAll(new LibraryFinder().find(dir, FileSystems.getDefault().getPathMatcher(getGlob(dir, pattern.substring(3))))); } return matches; }
private static Set<File> getMatchingLibraries(String pattern, Path dir) throws IOException { Set<File> matches = new LinkedHashSet<>(); Set<File> dirs = getMatchingDirs(pattern, dir); PathMatcher matcher = FileSystems.getDefault().getPathMatcher(getGlob(dir, pattern)); for (File d : dirs) { matches.addAll(getLibs(d.toPath())); } matches.addAll(dirs); matches.addAll(new LibraryFinder().find(dir, matcher)); if(pattern.startsWith("**/")) { // match jar in the base dir when using wildcard matches.addAll(new LibraryFinder().find(dir, FileSystems.getDefault().getPathMatcher(getGlob(dir, pattern.substring(3))))); } return matches; }