Java Directory Create mkdirs(File dir)

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

Description

Just a simple wrapper around `java.util.File.mkdirs()` that fails when trying to create a folder named "~"

License

Apache License

Declaration

public static boolean mkdirs(File dir) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    /**//from   w  w  w  . j  a v  a2s .  co  m
     * Just a simple wrapper around `java.util.File.mkdirs()` that fails
     * when trying to create a folder named "~"
     */
    public static boolean mkdirs(File dir) {
        String path = dir.getPath().replace('\\', '/');
        if (path.equals("~") || path.startsWith("~/") || path.contains("/~/")) {
            return false;
        }
        return dir.mkdirs();
    }
}

Related

  1. mkdirs(File dir)
  2. mkdirs(File dir)
  3. mkdirs(File dir)
  4. mkdirs(File dir)
  5. mkdirs(File dir)
  6. mkdirs(File dir)
  7. mkdirs(File directory)
  8. mkdirs(File directory)
  9. mkdirs(File directory)