55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
const path = require("node:path");
|
|
const fs = require("node:fs");
|
|
const https = require("node:https");
|
|
const process = require("node:process");
|
|
const os = require("node:os");
|
|
const child_process = require("node:child_process");
|
|
const electron = require("electron");
|
|
|
|
let configFilePath;
|
|
switch (os.platform()) {
|
|
case "win32":
|
|
configFilePath = path.join(process.env["LOCALAPPDATA"], "Plutonium", "open-plutonium-launcher.json");
|
|
break;
|
|
case "linux":
|
|
configFilePath = path.join(os.userInfo().homedir, ".config", "open-plutonium-launcher.json");
|
|
break;
|
|
case "darwin":
|
|
configFilePath = path.join(os.userInfo().homedir, "Library", "Application Support", "open-plutonium-launcher.json");
|
|
break;
|
|
default:
|
|
electron.dialog.showErrorBox("Incompatible system", "Sorry, your operating system doesn't seem to be supported...");
|
|
process.exit(1);
|
|
}
|
|
|
|
let mainWindow;
|
|
|
|
function createMainWindow() {
|
|
mainWindow = new electron.BrowserWindow({
|
|
"minWidth": 640,
|
|
"minHeight": 480,
|
|
"width": 800,
|
|
"height": 600,
|
|
"fullscreenable": false,
|
|
"show": false,
|
|
"webPreferences": {
|
|
"preload": path.join(__dirname, "preload.js"),
|
|
"contextIsolation": true
|
|
}
|
|
});
|
|
|
|
mainWindow.loadFile(path.join(__dirname, "index.html"));
|
|
|
|
mainWindow.once("ready-to-show", function () {
|
|
mainWindow.show();
|
|
});
|
|
}
|
|
|
|
electron.app.once("ready", function () {
|
|
createMainWindow();
|
|
});
|
|
|
|
electron.app.on("window-all-closed", function () {
|
|
electron.app.quit();
|
|
});
|