Unpack report face to given directory.

@param outputDirectory the output directory to unpack face.
@throws IOException if any occurs.
977624
private static void unpackFace(File outputDirectory) throws IOException {
        ClassLoader loader = AllureMain.class.getClassLoader();
        for (ClassPath.ResourceInfo info : ClassPath.from(loader).getResources()) {
            Matcher matcher = REPORT_RESOURCE_PATTERN.matcher(info.getResourceName());
            if (matcher.find()) {
                String resourcePath = matcher.group(1);
                File dest = new File(outputDirectory, resourcePath);
                Files.createParentDirs(dest);
                try (FileOutputStream output = new FileOutputStream(dest);
                     InputStream input = info.url().openStream()) {
                    IOUtils.copy(input, output);
                    LOGGER.debug("{} successfully copied.", resourcePath);
                }
            }
        }
    }
844437
public static void cleanDirectory(File directory) throws IOException {
    requireNonNull(directory, DIRECTORY_CAN_NOT_BE_NULL);

    Path path = directory.toPath();
    if (!path.toFile().exists()) {
      return;
    }

    cleanDirectoryImpl(path);
  }
1034870
public static void dumpAnalysisToFile(String outputDirName,
                                          String baseFileName,
                                          PartitionBalance partitionBalance) {
        if(outputDirName != null) {
            File outputDir = new File(outputDirName);
            if(!outputDir.exists()) {
                Utils.mkdirs(outputDir);
            }

            try {
                FileUtils.writeStringToFile(new File(outputDirName, baseFileName + ".analysis"),
                                            partitionBalance.toString());
            } catch(IOException e) {
                logger.error("IOException during dumpAnalysisToFile: " + e);
            }
        }
    }
245205
public File output() throws IOException {
        File o = new File(output);
        if (!o.exists() && !o.mkdirs()) {
            throw new IOException("Unable to create output folder '" + output + "'");
        }
        return o;
    }
939271
protected function getOutputDirectory(BundleSchemaInterface $bundleSchema, string $outputDirectory): string
    {
        $outputDirectory = \trim($outputDirectory);
        $outputDirectory = \str_replace('\\', \DIRECTORY_SEPARATOR, $outputDirectory);

        return $outputDirectory;
    }
1043889
public void unzip(String zipFilePath, String destDirectory) throws IOException {
        File destDir = new File(destDirectory);
        if (!destDir.exists()) {
            destDir.mkdir();
        }
        ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));
        ZipEntry entry = zipIn.getNextEntry();
        while (entry != null) {
            File destFile = new File(destDir, entry.getName());
            long lastModified = entry.getTime();
            if (!entry.isDirectory()) {
                extractFile(zipIn, destFile);
                if (lastModified != -1) {
                    destFile.setLastModified(entry.getTime());
                }
            } else {
                destFile.mkdir();
            }
            zipIn.closeEntry();
            entry = zipIn.getNextEntry();
        }
        zipIn.close();
    }
276510
public function setOutputDirectory(PhingFile $outputDirectory)
    {
        try {
            if (!$outputDirectory->exists()) {
                $this->log("Output directory does not exist, creating: " . $outputDirectory->getPath(), Project::MSG_VERBOSE);
                if (!$outputDirectory->mkdirs()) {
                    throw new IOException("Unable to create Output directory: " . $outputDirectory->getAbsolutePath());
                }
            }
            $this->outputDirectory = $outputDirectory->getCanonicalPath();
        } catch (IOException $ioe) {
            throw new BuildException($ioe);
        }
    }
563759
def _write_to_filepath(content, output):
    
    outdir = os.path.dirname(output)
    if outdir and not os.path.exists(outdir):
        os.makedirs(outdir)

    with anytemplate.compat.copen(output, 'w') as out:
        out.write(content)
643838
public static void setOutputPath(JobConf conf, Path outputDir) {
    if (!outputDir.isAbsolute()) {
      FileSystem.LogForCollect.info("set output path to relative path: "
          + outputDir + " working directory: " + conf.getWorkingDirectory());
    }
    outputDir = new Path(conf.getWorkingDirectory(), outputDir);
    conf.set("mapred.output.dir", outputDir.toString());
  }
1003056
public static void unZipFiles(File zipFile, File outputFolder) throws IOException {
        InputStream is = new BufferedInputStream(new FileInputStream(zipFile));
        try {
            unZipFiles(is, outputFolder);
        } finally {
            IOUtils.closeQuietly(is);
        }
    }
586020
private void generateReports(String outputDirectory) {
        logger.entering(outputDirectory);

        ClassLoader localClassLoader = this.getClass().getClassLoader();

        try (BufferedWriter writer = new BufferedWriter(new FileWriter(outputDirectory + File.separator + "index.html"));
                BufferedWriter jsonWriter = new BufferedWriter(new FileWriter(outputDirectory + File.separator
                        + "report.json"));
                BufferedReader templateReader = new BufferedReader(new InputStreamReader(
                        localClassLoader.getResourceAsStream("templates/RuntimeReporter/index.html")));) {

            JsonObject reporter = buildJSONReport();
            Gson gson = new GsonBuilder().setPrettyPrinting().create();
            String jsonReport = gson.toJson(reporter);
            jsonWriter.write(jsonReport);
            jsonWriter.newLine();

            generateHTMLReport(writer, templateReader, jsonReport);

        } catch (IOException | JsonParseException e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
            throw new ReporterException(e);
        }

        logger.exiting();
    }
1071281
@Reqiured
    public void setDumpDirectory(String dumpDirectory) {
        if (dumpDirectory != null && dumpDirectory.trim().length() > 0) {
            File file = new File(dumpDirectory);
            if (file.exists() || file.mkdirs()) {
                this.dumpDirectory = file;
            }
        }
    }
904238
public static void isValidOutputDirectory(File outputDirectory)
			throws InvalidOutputDirectoryException {
		if (!outputDirectory.exists()) {
			outputDirectory.mkdirs();
		}
		if (!outputDirectory.exists()) {
			throw new InvalidOutputDirectoryException("'" + outputDirectory
					+ "' doesn't exist.");
		}
		if (!outputDirectory.isDirectory()) {
			throw new InvalidOutputDirectoryException("'" + outputDirectory
					+ "' is not a directory.");
		}
		if (!outputDirectory.canWrite()) {
			throw new InvalidOutputDirectoryException("Unable to wrote into '"
					+ outputDirectory + "'.");
		}
	}
669220
protected void writeFile(String basename, byte[] content,
			Function2<? super File, ? super String, ? extends File> outputDirectoryFilter) {
		for (final String output : getOutputs()) {
			File directory = new File(output).getAbsoluteFile();
			if (outputDirectoryFilter != null) {
				directory = outputDirectoryFilter.apply(directory, basename);
			}
			try {
				final File outputFile = new File(directory, basename);
				outputFile.getParentFile().mkdirs();
				Files.write(Paths.get(outputFile.getAbsolutePath()), content);
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
	}
1273879
@Override
    public OutputStream getOutputStream() throws IOException {
        if (Files.isDirectory(this.path)) {
            throw new FileNotFoundException(getPath() + " (is a directory)");
        }
        return Files.newOutputStream(this.path);
    }
497042
static File getOutputDirectory(MavenProject rootModule) {
        String directoryName = rootModule.getBuild().getDirectory() + "/" + OUTPUT_DIRECTORY;
        File directory = new File(directoryName);
        directory.mkdirs();
        return directory;
    }
1033464
private void unpackFile(File file) throws MojoExecutionException {

    // initialize unpacker to validate patterns
    ContentUnpackerProperties props = new ContentUnpackerProperties();
    props.setExcludeFiles(this.excludeFiles);
    props.setExcludeNodes(this.excludeNodes);
    props.setExcludeProperties(this.excludeProperties);
    props.setExcludeMixins(this.excludeMixins);
    ContentUnpacker unpacker = new ContentUnpacker(props);

    // validate output directory
    if (this.unpackDirectory == null) {
      throw new MojoExecutionException("No unpack directory specified.");
    }
    if (!this.unpackDirectory.exists()) {
      this.unpackDirectory.mkdirs();
    }

    // remove existing content
    if (this.unpackDeleteDirectories != null) {
      for (String directory : unpackDeleteDirectories) {
        File directoryFile = FileUtils.getFile(this.unpackDirectory, directory);
        if (directoryFile.exists()) {
          if (!deleteDirectoryWithRetries(directoryFile, 0)) {
            throw new MojoExecutionException("Unable to delete existing content from "
                + directoryFile.getAbsolutePath());
          }
        }
      }
    }

    // unpack file
    unpacker.unpack(file, this.unpackDirectory);

    getLog().info("Package unpacked to " + this.unpackDirectory.getAbsolutePath());
  }