<commit_before>package org.approvaltests.reporters.intellij;

import java.io.IOException;
import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Comparator;
import java.util.Objects;
import java.util.Optional;

import com.spun.util.SystemUtils;

public class IntelliJPathResolver
{
  private final String channelsPath;
  public IntelliJPathResolver(Edition edition)
  {
    String appData = "";
    if (SystemUtils.isWindowsEnviroment())
    {
      appData = System.getenv("LOCALAPPDATA");
    }
    else if (SystemUtils.isMacEnviroment())
    {
      appData = System.getenv("HOME");
      appData += "/Library/Application Support";
    }
    else // Linux
    {
      appData = System.getenv("HOME");
      appData += "/.local/share";
    }
    String toolboxPath = appData + "/JetBrains/Toolbox";
    this.channelsPath = toolboxPath + "/apps/" + edition.getDirectory() + "/ch-0/";
  }
  public String findIt()
  {
    String notPresentPath = "C:\\Intelli-not-present.exe";
    try
    {
      return getIntelliJPath().map(Objects::toString).orElse(notPresentPath);
    }
    catch (IOException e)
    {
      return notPresentPath;
    }
  }
  private Optional<Path> getIntelliJPath() throws IOException
  {
    return Files.walk(Paths.get(channelsPath), 1, FileVisitOption.FOLLOW_LINKS) //
        .map(Path::getFileName) //
        .map(Objects::toString) //
        .filter(Version::isVersionFile) //
        .map(Version::new) //
        .max(Comparator.naturalOrder()) //
        .map(this::getPath);
  }
  private Path getPath(Version version)
  {
    String runtimeSuffix = "/bin/idea64.exe";
    return Paths.get(channelsPath + version.version + runtimeSuffix).toAbsolutePath();
  }
}
<commit_msg>r extract runtime suffix to field.<commit_after>package org.approvaltests.reporters.intellij;

import java.io.IOException;
import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Comparator;
import java.util.Objects;
import java.util.Optional;

import com.spun.util.SystemUtils;

public class IntelliJPathResolver
{
  private final String channelsPath;
  private final String runtimeSuffix;

  public IntelliJPathResolver(Edition edition)
  {
    String appData = "";
    if (SystemUtils.isWindowsEnviroment())
    {
      appData = System.getenv("LOCALAPPDATA");
    }
    else if (SystemUtils.isMacEnviroment())
    {
      appData = System.getenv("HOME");
      appData += "/Library/Application Support";
    }
    else // Linux
    {
      appData = System.getenv("HOME");
      appData += "/.local/share";
    }
    String toolboxPath = appData + "/JetBrains/Toolbox";
    this.channelsPath = toolboxPath + "/apps/" + edition.getDirectory() + "/ch-0/";
    runtimeSuffix = "/bin/idea64.exe";
  }
  public String findIt()
  {
    String notPresentPath = "C:\\Intelli-not-present.exe";
    try
    {
      return getIntelliJPath().map(Objects::toString).orElse(notPresentPath);
    }
    catch (IOException e)
    {
      return notPresentPath;
    }
  }
  private Optional<Path> getIntelliJPath() throws IOException
  {
    return Files.walk(Paths.get(channelsPath), 1, FileVisitOption.FOLLOW_LINKS) //
        .map(Path::getFileName) //
        .map(Objects::toString) //
        .filter(Version::isVersionFile) //
        .map(Version::new) //
        .max(Comparator.naturalOrder()) //
        .map(this::getPath);
  }
  private Path getPath(Version version)
  {
    return Paths.get(channelsPath + version.version + runtimeSuffix).toAbsolutePath();
  }
}

{'fraction_non_alphanumeric': 0.1330767115754743, 'fraction_numerical': 0.0021996150673632116, 'mean_word_length': 3.1482326111744583, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2658417', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1149, 'n_words': 206}