Java mkdir forceMkdir(File dir)

Here you can find the source of forceMkdir(File dir)

Description

force Mkdir

License

Open Source License

Declaration

public static void forceMkdir(File dir) throws IOException 

Method Source Code

//package com.java2s;
//it under the terms of the GNU Affero General Public License as published by

import java.io.File;

import java.io.IOException;

public class Main {
    public static void forceMkdir(File dir) throws IOException {
        boolean success = dir.isDirectory();
        if (!success) {
            success = dir.mkdirs();/*  w  w  w .j  av a2s.  c o  m*/
        }
        checkSuccess(success, "Cannot create directory " + dir);
    }

    private static void checkSuccess(boolean success, String message) throws IOException {
        if (!success) {
            throw new IOException(message);
        }
    }
}

Related

  1. forceMkdir(File directory)
  2. forceMkdir(File directory)
  3. forceMkdir(File directory)
  4. forceMkdir(String filePath)