<commit_before>/**
 * Unanimity
 */

var fs = require("fs");
var process = require("process");
var wrench = require("wrench");
var asar = require("asar");
var package = require("./package.json")

var discordPath;
var importLineNumber;
var functionLineNumber;
var functionCallLineNumber;
var packageLineNumber;

var appIndexPath = "/app/index.js";
var appPackagePath = "/app/package.json";
var discordVersion = "0.0.280";

function exit()
{
    process.exit();
}

/*
 type 0: message
 type 1: error
 */
function log(message, type)
{
    if (typeof document == "undefined") {
        var typeString;

        switch (type) {
            case 0:
                typeString = "";
                break;
            case 1:
                typeString = "Error: ";
                break;
            default:
                typeString = "";
                break;
        }

        console.log(typeString + message);
    } else {
        document.getElementsByTagName("progress")[0].style.visibility = "visible";
        document.getElementById("logs").innerHTML = message;

        if (type == 0) {
            document.getElementById("logs").className = "message";
        } else if (type == 1) {
            document.getElementById("logs").className = "error";
            document.getElementById("exitButton").disabled = false;
        }
    }
}

function setProgress(progress)
{
    if (typeof document != "undefined") {
        document.getElementsByTagName("progress")[0].value = progress;
    }
}

function install()
{
    if (typeof document != "undefined") {
        document.getElementById("installButton").disabled = true;
        document.getElementById("exitButton").disabled = true;
    }

    if (typeof discordPath == "undefined") {
		var os = process.platform;

		if (os == "darwin") {
			discordPath = "/Applications/Discord.app/Contents/Resources";
			importLineNumber = 84;
			functionLineNumber = 602;
			functionCallLineNumber = 500;
			packageLineNumber = 10;
		} else if (os == "win32") {
            //noinspection JSUnresolvedVariable
            discordPath = process.env.LOCALAPPDATA + "/Discord/app-" + discordVersion + "/resources";
            importLineNumber = 84;
            functionLineNumber = 597;
            functionCallLineNumber = 497;
            packageLineNumber = 10;
        } else {
			log("Unanimity only supports OS X and Windows.", 1);
		}
	}

    setProgress(10);

	fs.exists(discordPath, function (exists) {
		if (exists) {
			log("Discord folder found at " + discordPath + ".", 0);

			var appPath = discordPath + "/node_modules/Unanimity";
			var asarPath = discordPath + "/app.asar";<commit_msg>Improve user feedback during installation<commit_after>/**
 * Unanimity
 */

var fs = require("fs");
var process = require("process");
var wrench = require("wrench");
var asar = require("asar");
var package = require("./package.json")

var discordPath;
var importLineNumber;
var functionLineNumber;
var functionCallLineNumber;
var packageLineNumber;

var appIndexPath = "/app/index.js";
var appPackagePath = "/app/package.json";
var discordVersion = "0.0.280";

function exit()
{
    process.exit();
}

/*
 type 0: message
 type 1: error
 */
function log(message, type)
{
    if (typeof document == "undefined") {
        var typeString;

        switch (type) {
            case 0:
                typeString = "";
                break;
            case 1:
                typeString = "Error: ";
                break;
            default:
                typeString = "";
                break;
        }

        console.log(typeString + message);
    } else {
        document.getElementById("logs").innerHTML = message;

        if (type == 0) {
            document.getElementById("logs").className = "message";
        } else if (type == 1) {
            document.getElementById("logs").className = "error";
            document.getElementById("exitButton").disabled = false;
        }
    }
}

function setProgress(progress)
{
    if (typeof document != "undefined") {
        document.getElementsByTagName("progress")[0].style.visibility = "visible";
        document.getElementsByTagName("progress")[0].value = progress;
    }
}

function install()
{
    setProgress(10);
    log("Starting installation...");

    if (typeof document != "undefined") {
        document.getElementById("installButton").disabled = true;
        document.getElementById("exitButton").disabled = true;
    }

    if (typeof discordPath == "undefined") {
		var os = process.platform;

		if (os == "darwin") {
			discordPath = "/Applications/Discord.app/Contents/Resources";
			importLineNumber = 84;
			functionLineNumber = 602;
			functionCallLineNumber = 500;
			packageLineNumber = 10;
		} else if (os == "win32") {
            //noinspection JSUnresolvedVariable
            discordPath = process.env.LOCALAPPDATA + "/Discord/app-" + discordVersion + "/resources";
            importLineNumber = 84;
            functionLineNumber = 597;
            functionCallLineNumber = 497;
            packageLineNumber = 10;
        } else {
			log("Unanimity only supports OS X and Windows.", 1);
		}
	}

	fs.exists(discordPath, function (exists) {
		if (exists) {
			log("Discord folder found at " + discordPath + ".", 0);

			var appPath = discordPath + "/node_modules/Unanimity";
			var asarPath = discordPath + "/app.asar";
{'fraction_non_alphanumeric': 0.13169184853572094, 'fraction_numerical': 0.014549524342473419, 'mean_word_length': 2.5, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1392991', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1479, 'n_words': 353}