Code example for File

Methods: exists, getAbsolutePath, getParentFile, mkdirs

0
 
    throw new IllegalArgumentException("Could not find test class!");
  } 
 
  private static void createDir(File dir) throws IllegalAccessException {
    File parent = dir.getParentFile();
    if (!parent.exists()) {
      createDir(parent);
    } 
    if (!dir.exists() && !dir.mkdirs()) {
      throw new IllegalAccessException("Unable to create output dir: " + dir.getAbsolutePath());
    } 
    chmodPlusRWX(dir);
  } 
 
  private static void deletePath(File path, boolean inclusive) {
    if (path.isDirectory()) {
      File[] children = path.listFiles();
      if (children != null) {
        for (File child : children) {
          deletePath(child, true);