public DirectoryFileTree(File dir, PatternSet patternSet, FileSystem fileSystem) { this(FileUtils.canonicalize(dir), patternSet, DEFAULT_DIRECTORY_WALKER_FACTORY, fileSystem, false); }
@Override public boolean accept(File file) { return hasExtension(file, ".jar"); } });
/** * Checks if the given file path ends with the given extension (ignoring case). * @param fileName the file name * @param extension candidate extension including leading dot * @return true if the file name ends with extension, ignoring case */ public static boolean hasExtensionIgnoresCase(String fileName, String extension) { return endsWithIgnoreCase(fileName, extension); }
public Iterable<? extends File> getRoots() { return FileUtils.calculateRoots( Iterables.concat(files, Iterables.transform(trees, new Function<DirectoryTree, File>() { @Override public File apply(DirectoryTree input) { return input.getDir(); } })) ); }
@Override public void visitFileSnapshot(RegularFileSnapshot file) { if (FileUtils.hasExtensionIgnoresCase(file.getName(), ".jar")) { visitJar(file); } else { visitNonJar(file); } }
private Iterable<? extends File> calculateStartingWatchPoints(final Iterable<? extends File> roots, final FileSystemSubset unfiltered) { // Turn the requested watch points into actual enclosing directories that exist Iterable<File> enclosingDirsThatExist = Iterables.transform(roots, new Function<File, File>() { @Override public File apply(File input) { File target = input; while (!target.isDirectory()) { target = target.getParentFile(); } return target; } }); // Collapse the set return Iterables.filter(FileUtils.calculateRoots(enclosingDirsThatExist), new Predicate<File>() { @Override public boolean apply(File input) { return inCombinedRootsOrAncestorOfAnyRoot(input, roots, unfiltered); } }); }
public UriTextResource(String description, File sourceFile) { this.description = description; this.sourceFile = FileUtils.canonicalize(sourceFile); this.sourceUri = sourceFile.toURI(); }
public boolean isSatisfiedBy(File file) { return hasExtension(file, ".jawa"); } });
/** * Checks if the given file path ends with the given extension (ignoring case). * @param fileName the file name * @param extension candidate extension including leading dot * @return true if the file name ends with extension, ignoring case */ public static boolean hasExtensionIgnoresCase(String fileName, String extension) { return endsWithIgnoreCase(fileName, extension); }
private Delta init() { roots = fileSystemSubset.getRoots(); combinedRoots = fileSystemSubset.unfiltered(); Iterable<? extends File> startingWatchPointCandidates = calculateStartingWatchPoints(roots, combinedRoots); if (!currentWatchPoints.isEmpty()) { if (createNewStartingPointsUnderExistingRoots) { startingWatchPoints = filterCurrentWatchPoints(startingWatchPointCandidates); currentWatchPoints = ImmutableSet.<File>builder().addAll(currentWatchPoints).addAll(startingWatchPoints).build(); } else { Iterable<? extends File> combinedRoots = FileUtils.calculateRoots(Iterables.concat(currentWatchPoints, startingWatchPointCandidates)); startingWatchPoints = filterCurrentWatchPoints(combinedRoots); currentWatchPoints = ImmutableSet.copyOf(combinedRoots); } rootSubset.append(fileSystemSubset); } else { startingWatchPoints = startingWatchPointCandidates; rootSubset.append(fileSystemSubset); currentWatchPoints = ImmutableSet.copyOf(startingWatchPoints); } allRequestedRoots = ImmutableSet.<File>builder().addAll(allRequestedRoots).addAll(roots).build(); return this; }
UriTextResource(String description, URI sourceUri) { this.description = description; this.sourceFile = sourceUri.getScheme().equals("file") ? FileUtils.canonicalize(new File(sourceUri.getPath())) : null; this.sourceUri = sourceUri; }
public boolean isSatisfiedBy(File file) { return hasExtension(file, ".java"); } });
private BuildLayout layout(File rootDir, File settingsDir, File settingsFile) { return new BuildLayout(rootDir, settingsDir, FileUtils.canonicalize(settingsFile)); } }
private boolean isInProgressMarkerFile(File file) { return hasExtension(file, IN_PROGRESS_MARKER_FILE_SUFFIX); }
/** * Constructs JVM details by inspecting the current JVM. */ Jvm(OperatingSystem os) { this(os, FileUtils.canonicalize(new File(System.getProperty("java.home"))), JavaVersion.current(), false); }
private BuildLayout layout(File rootDir, File settingsDir, File settingsFile) { return new BuildLayout(rootDir, settingsDir, FileUtils.canonicalize(settingsFile)); } }
public static void ensureParentDirectoryExists(File file) { mkdirs(canonicalize(file).getParentFile()); } }
public static void ensureDirectoryExists(File directory) { mkdirs(canonicalize(directory)); }
public File getBuildFile() { return FileUtils.canonicalize(buildFile()); }
public File transform(String original) { if (original.startsWith("file:")) { try { return FileUtils.canonicalize(new File(new URI(original))); } catch (URISyntaxException e) { throw UncheckedException.throwAsUncheckedException(e); } } File file = new File(original); if (file.isAbsolute()) { return FileUtils.canonicalize(file); } if (URI_SCHEME.matcher(original).matches()) { throw new InvalidUserDataException(String.format("Cannot convert URL '%s' to a file.", original)); } file = new File(baseDir, original); return FileUtils.canonicalize(file); } }