public static void forceMkdir()

in src/main/java/org/apache/maven/shared/utils/io/FileUtils.java [1103:1122]


    public static void forceMkdir(@Nonnull final File file) throws IOException {
        if (Os.isFamily(Os.FAMILY_WINDOWS) && !isValidWindowsFileName(file)) {
            throw new IllegalArgumentException(
                    "The file (" + file.getAbsolutePath() + ") cannot contain any of the following characters: \n"
                            + StringUtils.join(INVALID_CHARACTERS_FOR_WINDOWS_FILE_NAME, " "));
        }

        if (file.exists()) {
            if (file.isFile()) {
                final String message =
                        "File " + file + " exists and is " + "not a directory. Unable to create directory.";
                throw new IOException(message);
            }
        } else {
            if (!file.mkdirs()) {
                final String message = "Unable to create directory " + file;
                throw new IOException(message);
            }
        }
    }