public void collectFiles( List<File> container, File from, String relativePath, final AntDomPattern pattern) { if (myDirsProcessed > MAX_DIRS_TO_PROCESS) { return; } myDirsProcessed++; final File[] children = from.listFiles(); if (children != null) { for (File child : children) { if (child.isDirectory()) { final String childPath = makePath(relativePath, child.getName()); if (pattern.acceptPath(childPath)) { container.add(child); } if (pattern.couldBeIncluded(childPath)) { collectFiles(container, child, childPath, pattern); } } } } }
@NotNull protected List<File> getFiles(@Nullable AntDomPattern pattern, Set<AntFilesProvider> processed) { assert pattern != null; final File singleFile = getCanonicalFile(getFile().getStringValue()); if (singleFile == null || pattern.hasIncludePatterns()) { // if singleFile is specified, there are no implicit includes final File root = getCanonicalFile(getDir().getStringValue()); if (root != null) { final ArrayList<File> files = new ArrayList<File>(); if (singleFile != null && singleFile.isDirectory()) { files.add(singleFile); } new FilesCollector().collectFiles(files, root, "", pattern); return files; } } if (singleFile != null && singleFile.isDirectory()) { Collections.singletonList(singleFile); } return Collections.emptyList(); }