<commit_before>'use strict';
const fs = require('fs');
const path = require('path');
const angular = require('angular');
const process = require('process');

angular.module('app').factory('config', config);

config.$inject = [];

const configPath = path.join(process.env.USER_DATA_PATH, 'user.json');

function config() {
  let config;

  if (fs.existsSync(configPath)) {
    try {
      config = JSON.parse(fs.readFileSync(configPath));
    } catch (e) {
      console.error(`Error when loading config: ${e.stack}`);
    }
  }
  if (!config) {
    config = {};
  }
<commit_msg>Fix linux issue with process.env usage. See https://github.com/electron/electron/issues/3306<commit_after>'use strict';
const fs = require('fs');
const path = require('path');
const angular = require('angular');
const {remote} = require('electron');

angular.module('app').factory('config', config);

config.$inject = [];

const configPath = path.join(remote.process.env.USER_DATA_PATH, 'user.json');
console.log('Config path:', configPath);

function config() {
  let config;

  if (fs.existsSync(configPath)) {
    try {
      config = JSON.parse(fs.readFileSync(configPath));
    } catch (e) {
      console.error(`Error when loading config: ${e.stack}`);
    }
  }
  if (!config) {
    config = {};
  }

{'fraction_non_alphanumeric': 0.17821011673151751, 'fraction_numerical': 0.0031128404669260703, 'mean_word_length': 4.144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '5410820', 'n_tokens_mistral': 410, 'n_tokens_neox': 403, 'n_words': 90}