<commit_before>"use strict";

const colors = require("colors/safe");
const fs = require("fs");
const path = require("path");

let home;

class Utils {
	static extraHelp() {
		[
			"",
			"",
			"  Environment variable:",
			"",
			`    THELOUNGE_HOME   Path for all configuration files and folders. Defaults to ${colors.green(Utils.defaultHome())}.`,
			"",
		].forEach((e) => console.log(e)); // eslint-disable-line no-console
	}

	static defaultHome() {
		if (home) {
			return home;
		}

		const distConfig = path.resolve(path.join(
			__dirname,
			"..",
			"..",
			".thelounge_home"
		));

		// TODO: Remove this section when releasing The Lounge v3
		const deprecatedDistConfig = path.resolve(path.join(
			__dirname,
			"..",
			"..",
			".lounge_home"
		));
		if (fs.existsSync(deprecatedDistConfig)) {
			log.warn(`${colors.green(".lounge_home")} is ${colors.bold("deprecated")} and will be ignored as of The Lounge v3.`);
			log.warn(`Renaming to ${colors.green(".thelounge_home")} instead.`);

			fs.renameSync(deprecatedDistConfig, distConfig);
		}

		home = fs.readFileSync(distConfig, "utf-8").trim();

		return home;
	}
}

module.exports = Utils;
<commit_msg>Do not rename home file as it is very likely to have permission issues<commit_after>"use strict";

const colors = require("colors/safe");
const fs = require("fs");
const path = require("path");

let home;

class Utils {
	static extraHelp() {
		[
			"",
			"",
			"  Environment variable:",
			"",
			`    THELOUNGE_HOME   Path for all configuration files and folders. Defaults to ${colors.green(Utils.defaultHome())}.`,
			"",
		].forEach((e) => console.log(e)); // eslint-disable-line no-console
	}

	static defaultHome() {
		if (home) {
			return home;
		}

		let distConfig;

		// TODO: Remove this section when releasing The Lounge v3
		const deprecatedDistConfig = path.resolve(path.join(
			__dirname,
			"..",
			"..",
			".lounge_home"
		));
		if (fs.existsSync(deprecatedDistConfig)) {
			log.warn(`${colors.green(".lounge_home")} is ${colors.bold("deprecated")} and will be ignored as of The Lounge v3.`);
			log.warn(`Use ${colors.green(".thelounge_home")} instead.`);

			distConfig = deprecatedDistConfig;
		} else {
			distConfig = path.resolve(path.join(
				__dirname,
				"..",
				"..",
				".thelounge_home"
			));
		}

		home = fs.readFileSync(distConfig, "utf-8").trim();

		return home;
	}
}

module.exports = Utils;

{'fraction_non_alphanumeric': 0.16901408450704225, 'fraction_numerical': 0.0024855012427506215, 'mean_word_length': 3.382940108892922, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6580855', 'n_tokens_mistral': 934, 'n_tokens_neox': 808, 'n_words': 186}