code: 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());
      }
    }
docs: Create the directory represented by the location if not exists.
  
  @param location the location for the directory.
  @throws java.io.IOException If the location cannot be created