aboutsummaryrefslogtreecommitdiff
path: root/src/app/main.js
blob: 404e762391f2df7db1e792e85e1a3e622b630108 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const fs = require("fs");
const path = require("path");
const { ipcRenderer } = require("electron");

var settings = {
	gamepath: "",
	file: "viper.json",
	zip: "/northstar.zip",
}

if (fs.existsSync(settings.file)) {
	settings.gamepath = {...settings, ...JSON.parse(fs.readFileSync(settings.file, "utf8"))};
	settings.zip = path.join(settings.gamepath + "/northstar.zip");
} else {
	alert("Game path is not set! Please select the path!");
	setpath();
}

function update() {ipcRenderer.send("update")}
function setpath() {ipcRenderer.send("setpath")}

function launch() {ipcRenderer.send("launch")}
function launchVanilla() {ipcRenderer.send("launchVanilla")}

ipcRenderer.on("newpath", (event, newpath) => {
	settings.gamepath = newpath;
})