/** * Override parent implementation. * @return count of included files. * @since Ant 1.7 */ public int getIncludedFilesCount() { if (src == null) { return super.getIncludedFilesCount(); } scanme(); return matchFileEntries.size(); }
@Override public int size() { final DirectoryScanner ds = getDirectoryScanner(getProject()); int count = type == SetType.file ? ds.getIncludedFilesCount() : ds.getIncludedDirsCount(); if (type == SetType.both) { count += ds.getIncludedFilesCount(); } return count; } }
/** * log a message for skipping a fileset. * @param currentType the current type. * @param ds the directory scanner. * @param base the dir base */ private void logSkippingFileset( String currentType, DirectoryScanner ds, File base) { int includedCount = (!FileDirBoth.DIR.equals(currentType) ? ds.getIncludedFilesCount() : 0) + (!FileDirBoth.FILE.equals(currentType) ? ds.getIncludedDirsCount() : 0); log("Skipping fileset for directory " + base + ". It is " + ((includedCount > 0) ? "up to date." : "empty."), verbose ? Project.MSG_INFO : Project.MSG_VERBOSE); }
private boolean hasMatch(File dir, String pattern, boolean bCaseSensitive) throws InterruptedException { class Cancel extends RuntimeException {} DirectoryScanner ds = bound == Integer.MAX_VALUE ? new DirectoryScanner() : new DirectoryScanner() { int ticks; long start = System.currentTimeMillis(); @Override public synchronized boolean isCaseSensitive() { if (!filesIncluded.isEmpty() || !dirsIncluded.isEmpty() || ticks++ > bound || System.currentTimeMillis() - start > 5000) { throw new Cancel(); } filesNotIncluded.clear(); dirsNotIncluded.clear(); // notFollowedSymlinks might be large, but probably unusual // scannedDirs will typically be largish, but seems to be needed return super.isCaseSensitive(); } }; ds.setBasedir(reading(dir)); ds.setIncludes(new String[] {pattern}); ds.setCaseSensitive(bCaseSensitive); try { ds.scan(); } catch (Cancel c) { if (ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0) { return true; } else { throw new InterruptedException("no matches found within " + bound); } } return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0; }
if (scanner.getIncludedFilesCount() > 0) { for (String s : scanner.getIncludedFiles()) { final File f = new File(baseDir, s);
/** * Fulfill the ResourceCollection contract. * @return number of elements as int. * @since Ant 1.7 */ @Override public int size() { if (isReference()) { return ((FileSet) getRef(getProject())).size(); } return getDirectoryScanner(getProject()).getIncludedFilesCount(); }
fs.setCaseSensitive(caseSensitive); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); if(ds.getIncludedFilesCount()!=0) {
/** * Fulfill the ResourceCollection contract. * @return number of elements as int. */ @Override public synchronized int size() { if (isReference()) { return getRef().size(); } ensureDirectoryScannerSetup(); ds.scan(); return ds.getIncludedFilesCount() + ds.getIncludedDirsCount(); }
/** * Fulfill the ResourceCollection contract. * @return number of elements as int. * @since Ant 1.7 */ @Override public int size() { if (isReference()) { return ((FileSet) getRef(getProject())).size(); } return getDirectoryScanner().getIncludedFilesCount() + getDirectoryScanner().getIncludedDirsCount(); }
/** * Fulfill the ResourceCollection contract. * @return an Iterator of Resources. */ @Override public synchronized Iterator<Resource> iterator() { if (isReference()) { return getRef().iterator(); } ensureDirectoryScannerSetup(); ds.scan(); int fct = ds.getIncludedFilesCount(); int dct = ds.getIncludedDirsCount(); if (fct + dct == 0) { return Collections.emptyIterator(); } FileResourceIterator result = new FileResourceIterator(getProject()); if (fct > 0) { result.addFiles(ds.getIncludedFiles()); } if (dct > 0) { result.addFiles(ds.getIncludedDirectories()); } return result; }
protected int getIncludedFilesCount() { return directoryScanner.getIncludedFilesCount(); }
protected int getIncludedFilesCount() { return directoryScanner.getIncludedFilesCount(); }
private boolean hasMatch(File dir, String pattern) { FileSet fs = Util.createFileSet(dir, pattern); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); return ds.getIncludedFilesCount() != 0 || ds.getIncludedDirsCount() != 0; }
private boolean hasMatch(File dir, String pattern) { FileSet fs = Util.createFileSet(dir,pattern); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0; }
private boolean hasMatch(File dir, String pattern) { FileSet fs = Util.createFileSet(dir,pattern); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0; }
private boolean hasMatch(File dir, String pattern) { FileSet fs = Util.createFileSet(dir,pattern); DirectoryScanner ds = fs.getDirectoryScanner(new Project()); return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0; }
private boolean hasFiles(String baseDir) { if (new File(baseDir).exists()) { DirectoryScanner directoryScanner = new DirectoryScanner(); directoryScanner.setBasedir(baseDir); directoryScanner.setIncludes(new String[] {ASTERISK}); directoryScanner.setExcludes(new String[] {"." + ASTERISK}); directoryScanner.scan(); return directoryScanner.getIncludedFilesCount() == 0; } return false; }
private boolean hasMatch(File dir, String pattern, boolean bCaseSensitive) throws InterruptedException { class Cancel extends RuntimeException {} DirectoryScanner ds = bound == Integer.MAX_VALUE ? new DirectoryScanner() : new DirectoryScanner() { int ticks; long start = System.currentTimeMillis(); @Override public synchronized boolean isCaseSensitive() { if (!filesIncluded.isEmpty() || !dirsIncluded.isEmpty() || ticks++ > bound || System.currentTimeMillis() - start > 5000) { throw new Cancel(); } filesNotIncluded.clear(); dirsNotIncluded.clear(); // notFollowedSymlinks might be large, but probably unusual // scannedDirs will typically be largish, but seems to be needed return super.isCaseSensitive(); } }; ds.setBasedir(reading(dir)); ds.setIncludes(new String[] {pattern}); ds.setCaseSensitive(bCaseSensitive); try { ds.scan(); } catch (Cancel c) { if (ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0) { return true; } else { throw new InterruptedException("no matches found within " + bound); } } return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0; }
scanner.scan(); foundFiles = scanner.getIncludedFilesCount();
if(ds.getIncludedFilesCount()!=0) {