Example usage for com.google.common.base Files createParentDirs

List of usage examples for com.google.common.base Files createParentDirs

Introduction

In this page you can find the example usage for com.google.common.base Files createParentDirs.

Prototype

public static void createParentDirs(File file) throws IOException 

Source Link

Document

Creates any necessary but nonexistent parent directories of the specified file.

Usage

From source file:de.martido.genny.codegen.AbstractSourceFileGenerator.java

/**
 * Creates the actual source file and, if necessary, all parent directories.
 * //from   ww  w  .  jav  a2 s  .c om
 * @param sourceFile
 *          <i>mandatory</i> - the {@link SourceFile}.
 * @return A {@code File}.
 * @throws IOException
 *           If an I/O error occured.
 */
protected File createFile(SourceFile sourceFile) throws IOException {
    File file = new File(sourceFile.asPath());
    Files.createParentDirs(file);
    Files.touch(file);
    return file;
}