public static boolean ensureCanCreateFile(@NotNull File file) {
    if (file.exists()) {
      return file.canWrite();
    }
    if (!createIfNotExists(file)) {
      return false;
    }
    return delete(file);
  }
public static boolean ensureCanCreateFile(@NotNull File file)