Here you can find the source of forceFolderExist(String folder)
Parameter | Description |
---|---|
folder | folder to create if it does not exist |
Parameter | Description |
---|---|
IOException | an exception |
// ////////////////////////////////////////////////////// public static void forceFolderExist(String folder) throws IOException
//package com.java2s; import java.io.*; public class Main { /**/*from w w w. j a v a 2s . c om*/ * Create folder if it's not exist * * @param folder * folder to create if it does not exist * @throws IOException * @author Thai Hoang Hiep */ // ////////////////////////////////////////////////////// public static void forceFolderExist(String folder) throws IOException { File flTemp = new File(folder); if (!flTemp.exists()) { if (!flTemp.mkdirs()) throw new IOException("Could not create folder " + folder); } else if (!flTemp.isDirectory()) throw new IOException("A file with name" + folder + " already exist"); } }