aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-01-05 00:37:38 +0100
committer0neGal <mail@0negal.com>2022-01-05 00:37:38 +0100
commita898d6866a912abceb78832bc1b3fe2ff56d1335 (patch)
tree9067a550a1f110b37cfa8cd99ce7a80b156c442d /src/app
parentdce0f68e7f9095ffa400112f03968251999a92dc (diff)
parent89d8d1986b62d5686160f28359383ccd0c67f77d (diff)
downloadViper-a898d6866a912abceb78832bc1b3fe2ff56d1335.tar.gz
Viper-a898d6866a912abceb78832bc1b3fe2ff56d1335.zip
Merge branch 'main' of 0neGal/viper into mod-support
Diffstat (limited to 'src/app')
-rw-r--r--src/app/main.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 6f2493a..a5c0a37 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -20,14 +20,28 @@ ipcRenderer.send("setlang", settings.lang);
if (fs.existsSync("viper.json")) {
settings = {...settings, ...JSON.parse(fs.readFileSync("viper.json", "utf8"))};
settings.zip = path.join(settings.gamepath + "/northstar.zip");
+
+ if (settings.gamepath.length === 0) {
+ alert(lang("general.missingpath"));
+ setpath(false);
+ } else {
+ setpath(true);
+ }
} else {
- alert(lang("general.missinggamepath"));
+ alert(lang("general.missingpath"));
setpath();
}
function exit() {ipcRenderer.send("exit")}
function update() {ipcRenderer.send("update")}
-function setpath() {ipcRenderer.send("setpath")}
+
+/**
+ * Reports to the main thread about game path status.
+ * @param {boolean} value is game path loaded
+ */
+function setpath(value = false) {
+ ipcRenderer.send("setpath", value);
+}
function launch() {ipcRenderer.send("launch")}
function launchVanilla() {ipcRenderer.send("launchVanilla")}
@@ -145,6 +159,11 @@ ipcRenderer.on("updateavailable", () => {
}
})
+ipcRenderer.on("nopathselected", () => {
+ alert(lang("gui.gamepath.must"));
+ exit();
+});
+
setlang();
setInterval(() => {
ipcRenderer.send("setsize", document.querySelector(".lines").offsetHeight + 20);