aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2021-12-26 19:06:09 +0100
committer0neGal <mail@0negal.com>2021-12-26 19:06:09 +0100
commite6a3c962330289e02276b0fafe4629598933e54e (patch)
tree1bbd399e922bc475e6a092013a16fc903f2bcf3e /src/app
parent3c4dc8d62d2ccbc4e40c26a4c99475fcd7e75036 (diff)
downloadViper-e6a3c962330289e02276b0fafe4629598933e54e.tar.gz
Viper-e6a3c962330289e02276b0fafe4629598933e54e.zip
you can now set the game path in the UI
Diffstat (limited to 'src/app')
-rw-r--r--src/app/index.html2
-rw-r--r--src/app/main.js13
2 files changed, 13 insertions, 2 deletions
diff --git a/src/app/index.html b/src/app/index.html
index 97a14ab..263a903 100644
--- a/src/app/index.html
+++ b/src/app/index.html
@@ -9,7 +9,7 @@
<div class="text">Welcome to Viper!</div>
<div class="buttons">
<button id="update" onclick="update()">Update</button>
- <button id="setpath">Game Path</button>
+ <button id="setpath" onclick="setpath()">Game Path</button>
</div>
</div>
<div class="line">
diff --git a/src/app/main.js b/src/app/main.js
index b7071ec..352e654 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -2,7 +2,7 @@ const fs = require("fs");
const path = require("path");
const unzip = require("unzipper");
const request = require("request");
-const { dialog } = require("electron");
+const { ipcRenderer } = require("electron");
const { https } = require("follow-redirects");
var settings = {
@@ -14,6 +14,9 @@ var settings = {
if (fs.existsSync(settings.file)) {
settings.gamepath = JSON.parse(fs.readFileSync(settings.file, "utf8")).path;
settings.zip = path.join(settings.gamepath + "/northstar.zip");
+} else {
+ alert("Game path is not set! Please select the path!");
+ setpath();
}
function update() {
@@ -36,3 +39,11 @@ function update() {
})
})
}
+
+function setpath() {
+ ipcRenderer.send("setpath");
+}
+
+ipcRenderer.on("newpath", (event, newpath) => {
+ settings.gamepath = newpath;
+})