for (File inputFile : files) { File outputFile = new File(outputDir, FileUtils.relativePath(inputFile, inputDir)); FileUtils.copyFile(inputFile, outputFile);
/** * Makes a copy of the directory's content, in the specified location, while maintaining the * directory structure. So the entire directory tree from the source will be copied. * * @param from directory from which the content is copied * @param to destination directory, will be created if does not exist */ public static void copyDirectoryContentToDirectory( @NonNull final File from, @NonNull final File to) throws IOException { Preconditions.checkArgument(from.isDirectory(), "Source path is not a directory."); File[] children = from.listFiles(); if (children != null) { for (File f : children) { if (f.isDirectory()) { File destination = new File(to, relativePath(f, from)); Files.createParentDirs(destination); mkdirs(destination); copyDirectoryContentToDirectory(f, destination); } else if (f.isFile()) { File destination = new File(to, relativePath(f.getParentFile(), from)); Files.createParentDirs(destination); mkdirs(destination); copyFileToDirectory(f, destination); } } } }
private static void instrumentFilesFullRun( @NonNull Instrumenter instrumenter, @NonNull File inputDir, @NonNull File outputDir) throws IOException { FileUtils.cleanOutputDir(outputDir); Iterable<File> files = FileUtils.getAllFiles(inputDir); for (File inputFile : files) { if (!inputFile.getName().endsWith(SdkConstants.DOT_CLASS)) { continue; } File outputFile = new File(outputDir, FileUtils.relativePath(inputFile, inputDir)); instrumentFile(instrumenter, inputFile, outputFile); } }
for (File lib : FileUtils.find(jniFolder, Pattern.compile("\\.so$"))) { File destLibFile = new File(libBundleFolder, FileUtils.relativePath(lib, jniFolder)); if (!destLibFile.getParentFile().exists()) { FileUtils.mkdirs(destLibFile.getParentFile()); new File( javaResBundleFolder, FileUtils.relativePath(javaResFile, javaResource)); if (!destJavaResFile.getParentFile().exists()) { FileUtils.mkdirs(destJavaResFile.getParentFile()); new ZipEntry( FileUtils.toSystemIndependentPath( FileUtils.relativePath(file, bundleFolder)))); zipOutputStream.write(inputBuffer, 0, inputBuffer.length); zipOutputStream.closeEntry();
@Override public void processFile(@NonNull File sourceFolder, @NonNull File sourceFile) throws ProcessException, IOException { ProcessInfoBuilder builder = new ProcessInfoBuilder(); builder.setExecutable(mGlslcLocation); // working dir for the includes builder.addArgs("-I", mSourceFolder.getPath()); // compute the output file path String relativePath = FileUtils.relativePath(sourceFile, sourceFolder); File destFile = new File(mOutputDir, relativePath + ".spv"); // add the args builder.addArgs(getArgs(relativePath)); // the source file builder.addArgs(sourceFile.getPath()); // add the output file builder.addArgs("-o", destFile.getPath()); // make sure the output file's parent folder is created. FileUtils.mkdirs(destFile.getParentFile()); ProcessResult result = mProcessExecutor.execute( builder.createProcess(), mProcessOutputHandler); result.rethrowFailure().assertNormalExitValue(); }
private void render( @NonNull final DependencyNode node, @NonNull Map<Object, Dependency> dependencyMap, boolean lastChild) { renderer.visit(styledTextOutput -> { String name = node.getAddress().toString(); Dependency dependency = dependencyMap.get(name); if (dependency instanceof JavaDependency) { JavaDependency javaDependency = (JavaDependency) dependency; if (javaDependency.isLocal()) { String path = FileUtils.relativePath( javaDependency.getArtifactFile(), project.getProjectDir()); name = path; } } getTextOutput().text(name); }, lastChild); renderChildren(node.getDependencies(), dependencyMap); }
String path = FileUtils.relativePath(input, folder); File strippedLib = new File(output, path);
String path = FileUtils.relativePath(inputFile, inputRootDirectory); if (!inputFile.getPath().endsWith(SdkConstants.DOT_CLASS)) { File outputFile = new File(outputDirectory, path);