private void check(File folder, Collection<String> matched, String pathPattern, File rootFolder) { File[] files = folder.listFiles(); for (File file : files) { if (file.isDirectory()) { check(file, matched, pathPattern, rootFolder); } else { String relativePath = file.getAbsolutePath().substring(rootFolder.getAbsolutePath().length() + 1); relativePath = relativePath.replace('\\', '/'); if (new AntPathMatcher().match(pathPattern, relativePath)) { matched.add(relativePath); } } } }
private void check(File folder, Collection<String> matched, String pathPattern, File rootFolder) { File[] files = folder.listFiles(); for (File file : files) { if (file.isDirectory()) { check(file, matched, pathPattern, rootFolder); } else { String relativePath = file.getAbsolutePath().substring(rootFolder.getAbsolutePath().length() + 1); relativePath = relativePath.replace('\\', '/'); if (new AntPathMatcher().match(pathPattern, relativePath)) { matched.add(relativePath); } } } }
private Set<String> processClasspathPathPatterns() { Set<String> processedClasspath = new HashSet<String>(classpath.size()); for (PathEntry pathEntry : classpath) { String path = pathEntry.getPath().replace('\\', '/').trim(); if (path.contains("*") || path.contains("?")) { check(projectFolder, processedClasspath, path, projectFolder); } else { // without wildcard path if (path.endsWith("/")) { // it is a folder processedClasspath.add(path); } else { File file = new File(path); if (file.isAbsolute() && file.isDirectory()) { // it is a folder processedClasspath.add(path + "/"); } else if (new File(projectFolder, path).isDirectory()) { // it is a folder processedClasspath.add(path + "/"); } else { // it is a file processedClasspath.add(path); } } } } return processedClasspath; }
private Set<String> processClasspathPathPatterns() { Set<String> processedClasspath = new HashSet<String>(classpath.size()); for (PathEntry pathEntry : classpath) { String path = pathEntry.getPath().replace('\\', '/').trim(); if (path.contains("*") || path.contains("?")) { check(projectFolder, processedClasspath, path, projectFolder); } else { // without wildcard path if (path.endsWith("/")) { // it is a folder processedClasspath.add(path); } else { File file = new File(path); if (file.isAbsolute() && file.isDirectory()) { // it is a folder processedClasspath.add(path + "/"); } else if (new File(projectFolder, path).isDirectory()) { // it is a folder processedClasspath.add(path + "/"); } else { // it is a file processedClasspath.add(path); } } } } return processedClasspath; }