<commit_before>import fs from "fs";
import shortcut from "keymage";
import EditorStore from "../stores/EditorStore";
import { click } from "../utils/FileUtils";

function openFile(path) {
    fs.readFile(path, "utf8", (error, content) => {
        if (error) {
            console.log(error);
        } else {
            EditorStore.changePath(path);
            EditorStore.changeContent(content);
            EditorStore.saved = true;
        }
    });
}

function saveFile(path, content) {
    fs.writeFile(path, content, (error) => {
        if (error) {
            console.log(error);
        } else {
            EditorStore.changePath(path);
            EditorStore.changeContent(content);
            EditorStore.saved = true;
        }
    });
}

shortcut("defmod-o", (event) => {
    event.preventDefault();
    event.stopPropagation();

    click("#openFile", (e) => {
        openFile(e.target.value);<commit_msg>:heavy_plus_sign: Open new Qilin instance with shortcut<commit_after>import fs from "fs";
import shortcut from "keymage";
import EditorStore from "../stores/EditorStore";
import { click } from "../utils/FileUtils";

function openFile(path) {
    fs.readFile(path, "utf8", (error, content) => {
        if (error) {
            console.log(error);
        } else {
            EditorStore.changePath(path);
            EditorStore.changeContent(content);
            EditorStore.saved = true;
        }
    });
}

function saveFile(path, content) {
    fs.writeFile(path, content, (error) => {
        if (error) {
            console.log(error);
        } else {
            EditorStore.changePath(path);
            EditorStore.changeContent(content);
            EditorStore.saved = true;
        }
    });
}

shortcut("defmod-n", (event) => {
    event.preventDefault();
    event.stopPropagation();

    nw.Window.open("dist/index.html", {
        new_instance: true,
        focus: true,
        frame: false,
        min_height: 600,
        min_width: 1000,
    });

    return false;
});

shortcut("defmod-o", (event) => {
    event.preventDefault();
    event.stopPropagation();

    click("#openFile", (e) => {
        openFile(e.target.value);
{'fraction_non_alphanumeric': 0.14580467675378267, 'fraction_numerical': 0.0041265474552957355, 'mean_word_length': 2.281203007518797, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '353017', 'n_tokens_mistral': 658, 'n_tokens_neox': 646, 'n_words': 124}