@NotNull
  public static File createTempDirectory(@NotNull File dir,
                                         @NotNull String prefix, @Nullable String suffix,
                                         boolean deleteOnExit) throws IOException {
    File file = doCreateTempFile(dir, prefix, suffix, true);
    if (deleteOnExit) {
      // default deleteOnExit does not remove dirs if they are not empty
      FilesToDeleteHolder.ourFilesToDelete.add(file.getPath());
    }
    if (!file.isDirectory()) {
      throw new IOException("Cannot create a directory: " + file);
    }
    return file;
  }
@NotNull
  public static File createTempDirectory(@NotNull File dir,
                                         @NotNull String prefix, @Nullable String suffix,
                                         boolean deleteOnExit)