private static @Nullable Path getCommandHistoryDir() {
    Path dir = Paths.get(PathManager.getSystemPath()).resolve("terminal/history");
    if (Files.isDirectory(dir)) {
      return dir;
    }
    if (Files.exists(dir)) {
      LOG.warn("Not a directory " + dir);
      return null;
    }
    deleteOldHistoryDir();
    try {
      Files.createDirectories(dir);
      return dir;
    }
    catch (IOException e) {
      LOG.warn("Cannot create " + dir, e);
      return null;
    }
  }
private static @Nullable Path getCommandHistoryDir()