public static void mkdirsIfNotExists ( Location location ) throws IOException { // Need to check && mkdir && check to deal with race condition if ( ! location . isDirectory ( ) && ! location . mkdirs ( ) && ! location . isDirectory ( ) ) { throw new IOException ( "Failed to create directory at " + location . toURI ( ) ) ; } }
Create the directory represented by the location if not exists .