public static @NotNull List<FirefoxProfile> computeProfiles(@Nullable File profilesFile) {
    if (profilesFile == null || !profilesFile.isFile()) {
      return Collections.emptyList();
    }

      try (BufferedReader reader = new BufferedReader(new FileReader(profilesFile))) {
        final List<FirefoxProfile> profiles = new SmartList<>();
        boolean insideProfile = false;
        String currentName = null;
        String currentPath = null;
        boolean isDefault = false;
        boolean isRelative = false;
        boolean eof = false;
        while (!eof) {
          String line = reader.readLine();
          if (line == null) {
            eof = true;
            line = "[]";
          }
          else {
            line = line.trim();
          }

          if (line.startsWith("[") && line.endsWith("]")) {
            if (!StringUtil.isEmpty(currentPath) && !StringUtil.isEmpty(currentName)) {
              profiles.add(new FirefoxProfile(currentName, currentPath, isDefault, isRelative));
            }
            currentName = null;
            currentPath = null;
            isDefault = false;
            isRelative = false;
            insideProfile = StringUtil.startsWithIgnoreCase(line, "[Profile");
            continue;
          }

          final int i = line.indexOf('=');
          if (i != -1 && insideProfile) {
            String name = line.substring(0, i).trim();
            String value = line.substring(i + 1).trim();
            if (name.equalsIgnoreCase("path")) {
              currentPath = value;
            }
            else if (name.equalsIgnoreCase("name")) {
              currentName = value;
            }
            else if (name.equalsIgnoreCase("default") && value.equals("1")) {
              isDefault = true;
            }
            else //noinspection SpellCheckingInspection
              if (name.equalsIgnoreCase("isrelative") && value.equals("1")) {
                isRelative = true;
              }
          }
        }
        return profiles;
      }
    catch (IOException e) {
      LOG.info(e);
      return Collections.emptyList();
    }
  }
public static @NotNull List<FirefoxProfile> computeProfiles(@Nullable File profilesFile)