private static void deleteOldHistoryDir() {
    Path dir = PathManager.getConfigDir().resolve("terminal/history");
    if (Files.isDirectory(dir)) {
      try {
        FileUtil.delete(dir);
        LOG.info("Old config/terminal/history/ deleted: " + dir);
      }
      catch (IOException e) {
        LOG.warn("Cannot delete old terminal/history/", e);
      }
    }

    Path parentDir = dir.getParent();
    if (!Files.isDirectory(parentDir)) {
      LOG.info("Old terminal/ directory does not exist or not a directory: " + parentDir);
      return;
    }

    boolean empty = false;
    try (Stream<Path> s = Files.list(parentDir)) {
      empty = s.findAny().isEmpty();
    }
    catch (IOException e) {
      LOG.warn("Cannot list files in " + parentDir, e);
    }
    if (empty) {
      try {
        FileUtil.delete(parentDir);
        LOG.info("Old terminal/ deleted: " + dir);
      }
      catch (IOException e) {
        LOG.warn("Cannot delete old terminal/", e);
      }
    }
  }
private static void deleteOldHistoryDir()