private void createEcjOptionFile() throws IOException { checkNotNull(options.getEcjOptionFile()); StringBuilder sb = new StringBuilder(); for (File sourceFile : options.getInputFiles()) { sb.append('\"') .append(FileUtils.toSystemIndependentPath(sourceFile.getAbsolutePath())) .append('\"') .append("\n"); } FileUtils.mkdirs(options.getEcjOptionFile().getParentFile()); Files.write(sb.toString(), options.getEcjOptionFile(), Charsets.UTF_8); }
/** * Find a list of files in a directory, using a specified path pattern. */ public static List<File> find(@NonNull File base, @NonNull final Pattern pattern) { checkArgument(base.isDirectory(), "'%s' must be a directory.", base.getAbsolutePath()); return Files.fileTreeTraverser() .preOrderTraversal(base) .filter(file -> pattern.matcher( FileUtils.toSystemIndependentPath(file.getPath())).find()) .toList(); }
/** * Creates a new relative file. * * @param base the base directory * @param file the file, must not be the same as the base directory and must be located inside * {@code base} */ public RelativeFile(@NonNull File base, @NonNull File file) { Preconditions.checkArgument(!base.equals(file), "base.equals(file)"); this.base = base; this.file = file; String relativePath = FileUtils. relativePossiblyNonExistingPath(file, base); osIndependentRelativePath = FileUtils.toSystemIndependentPath(relativePath); }
zipOutputStream.putNextEntry( new ZipEntry( FileUtils.toSystemIndependentPath( FileUtils.relativePath(file, bundleFolder)))); zipOutputStream.write(inputBuffer, 0, inputBuffer.length);
FileUtils.toSystemIndependentPath( FileOpUtils.makeRelative( sourceFolder, sourceFile, FileOpUtils.create()));