private List<DirectoryGroup> collectDirectoryData(ConfigDirsSearchResult result, @Nullable ProgressIndicator indicator) {
    var configPaths = result.getPaths();
    var groups = new ArrayList<DirectoryGroup>(configPaths.size());
    var productInfoFileName = SystemInfo.isMac ? ApplicationEx.PRODUCT_INFO_FILE_NAME_MAC : ApplicationEx.PRODUCT_INFO_FILE_NAME;

    for (var configPath : configPaths) {
      var directories = result.findRelatedDirectories(configPath, myBestBefore != 0);
      if (directories.isEmpty()) continue;

      var nameAndVersion = result.getNameAndVersion(configPath);
      long lastUpdated = 0, size = 0;
      int entriesToDelete = 0;
      var isInstalled = false;
      for (var directory : directories) {
        var visitor = new StatsCollectingVisitor(indicator);
        try {
          Files.walkFileTree(directory, visitor);
          var homeDir = Path.of(Files.readString(directory.resolve(ApplicationEx.LOCATOR_FILE_NAME)));
          if (Files.exists(homeDir)) {
            try (var reader = Files.newBufferedReader(homeDir.resolve(productInfoFileName)); var parser = new JsonFactory().createParser(reader)) {
              if (nameAndVersion.equals(JacksonUtil.readSingleField(parser, "dataDirectoryName"))) {
                isInstalled = true;
              }
            }
            catch (NoSuchFileException e) {
              myLogger.debug(e);
              isInstalled = true;  // the file could be missing from a self-built installation
            }
          }
        }
        catch (IOException | InvalidPathException e) {
          myLogger.debug(e);
        }
        lastUpdated = Math.max(lastUpdated, visitor.lastUpdated);
        size += visitor.size;
        entriesToDelete += visitor.entriesToDelete;
      }
      if (myBestBefore == 0 || lastUpdated <= myBestBefore) {
        groups.add(new DirectoryGroup(nameAndVersion, directories, lastUpdated, size, entriesToDelete, isInstalled));
      }
    }

    return groups;
  }
private List<DirectoryGroup> collectDirectoryData(ConfigDirsSearchResult result, @Nullable ProgressIndicator indicator)