Java Code Examples for org.apache.tools.ant.DirectoryScanner#getIncludedDirectories()
The following examples show how to use
org.apache.tools.ant.DirectoryScanner#getIncludedDirectories() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WildcardScanner.java From gocd with Apache License 2.0 | 6 votes |
public File[] getFiles() { DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(rootPath); scanner.setIncludes(new String[]{pattern}); scanner.scan(); String[] allPaths = scanner.getIncludedFiles(); List<File> allFiles = new ArrayList<>(); String[] directories = scanner.getIncludedDirectories(); for (String directory : directories) { allFiles.add(new File(rootPath, directory)); } for (int i = 0; i < allPaths.length; i++) { File file = new File(rootPath, allPaths[i]); if (!allFiles.contains(file.getParentFile())) { allFiles.add(file); } } return allFiles.toArray(new File[]{}); }
Example 2
Source File: TestProduct.java From IntelliJDeodorant with MIT License | 5 votes |
public Resource[][] grabResources(FileSet[] filesets, Project thisProject) { Resource[][] result = new Resource[filesets.length][]; for (int i = 0; i < filesets.length; i++) { boolean skipEmptyNames = true; if (filesets[i] instanceof ZipFileSet) { ZipFileSet zfs = (ZipFileSet) filesets[i]; skipEmptyNames = zfs.getPrefix(thisProject).equals("") && zfs.getFullpath(thisProject).equals(""); } DirectoryScanner rs = filesets[i].getDirectoryScanner(thisProject); if (rs instanceof ZipScanner) { ((ZipScanner) rs).setEncoding(encoding); } Vector<Resource> resources = new Vector<Resource>(); if (!doFilesonly) { String[] directories = rs.getIncludedDirectories(); for (int j = 0; j < directories.length; j++) { if (!"".equals(directories[j]) || !skipEmptyNames) { resources.addElement(rs.getResource(directories[j])); } } } String[] files = rs.getIncludedFiles(); for (int j = 0; j < files.length; j++) { if (!"".equals(files[j]) || !skipEmptyNames) { resources.addElement(rs.getResource(files[j])); } } result[i] = new Resource[resources.size()]; resources.copyInto(result[i]); } return result; }
Example 3
Source File: TestProduct.java From IntelliJDeodorant with MIT License | 5 votes |
public Resource[][] grabResources(FileSet[] filesets, Project thisProject) { Resource[][] result = new Resource[filesets.length][]; for (int i = 0; i < filesets.length; i++) { boolean skipEmptyNames = true; if (filesets[i] instanceof ZipFileSet) { ZipFileSet zfs = (ZipFileSet) filesets[i]; skipEmptyNames = zfs.getPrefix(thisProject).equals("") && zfs.getFullpath(thisProject).equals(""); } DirectoryScanner rs = filesets[i].getDirectoryScanner(thisProject); if (rs instanceof ZipScanner) { ((ZipScanner) rs).setEncoding(encoding); } Vector<Resource> resources = new Vector<Resource>(); if (!doFilesonly) { String[] directories = rs.getIncludedDirectories(); for (int j = 0; j < directories.length; j++) { if (!"".equals(directories[j]) || !skipEmptyNames) { resources.addElement(rs.getResource(directories[j])); } } } String[] files = rs.getIncludedFiles(); for (int j = 0; j < files.length; j++) { if (!"".equals(files[j]) || !skipEmptyNames) { resources.addElement(rs.getResource(files[j])); } } result[i] = new Resource[resources.size()]; resources.copyInto(result[i]); } return result; }
Example 4
Source File: Test.java From IntelliJDeodorant with MIT License | 5 votes |
protected Resource[][] grabResources(FileSet[] filesets) { Resource[][] result = new Resource[filesets.length][]; for (int i = 0; i < filesets.length; i++) { boolean skipEmptyNames = true; if (filesets[i] instanceof ZipFileSet) { ZipFileSet zfs = (ZipFileSet) filesets[i]; skipEmptyNames = zfs.getPrefix(getProject()).equals("") && zfs.getFullpath(getProject()).equals(""); } DirectoryScanner rs = filesets[i].getDirectoryScanner(getProject()); if (rs instanceof ZipScanner) { ((ZipScanner) rs).setEncoding(encoding); } Vector<Resource> resources = new Vector<Resource>(); if (!doFilesonly) { String[] directories = rs.getIncludedDirectories(); for (int j = 0; j < directories.length; j++) { if (!"".equals(directories[j]) || !skipEmptyNames) { resources.addElement(rs.getResource(directories[j])); } } } String[] files = rs.getIncludedFiles(); for (int j = 0; j < files.length; j++) { if (!"".equals(files[j]) || !skipEmptyNames) { resources.addElement(rs.getResource(files[j])); } } result[i] = new Resource[resources.size()]; resources.copyInto(result[i]); } return result; }
Example 5
Source File: CompleterHelper.java From yiistorm with MIT License | 5 votes |
public static String[] searchFolders(String searchPath, String searchString) { DirectoryScanner scanner = new DirectoryScanner(); scanner.setIncludes(new String[]{searchString + "*"}); scanner.setExcludes(new String[]{searchString + "*.php"}); scanner.setBasedir(searchPath); scanner.setCaseSensitive(false); scanner.scan(); return scanner.getIncludedDirectories(); }