Here you can find the source of createDirectoryIfNotExists(Path path)
Parameter | Description |
---|---|
path | path to this directory. |
Parameter | Description |
---|---|
IOException | if directories cannot be created. |
public static void createDirectoryIfNotExists(Path path) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.Path; public class Main { /**/*from w w w .j a v a2s . c om*/ * Check specified directory. * * @param path path to this directory. * @throws IOException if directories cannot be created. */ public static void createDirectoryIfNotExists(Path path) throws IOException { try { Files.createDirectories(path); } catch (FileAlreadyExistsException ignored) { } } }