aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app/main.js3
-rw-r--r--src/modules/settings.js2
-rw-r--r--src/modules/update.js17
3 files changed, 17 insertions, 5 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 1c846b4..7382a37 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -1,6 +1,6 @@
const fs = require("fs");
const path = require("path");
-const { ipcRenderer, shell } = require("electron");
+const { app, ipcRenderer, shell } = require("electron");
const lang = require("../lang");
var modsobj = {};
@@ -46,7 +46,6 @@ if (fs.existsSync("viper.json")) {
}
settings = {...settings, ...json};
- settings.zip = path.join(settings.gamepath + "/northstar.zip");
if (settings.gamepath.length === 0) {
setpath(false);
diff --git a/src/modules/settings.js b/src/modules/settings.js
index d71ea2a..76326cc 100644
--- a/src/modules/settings.js
+++ b/src/modules/settings.js
@@ -40,7 +40,7 @@ if (fs.existsSync("viper.json")) {
...settings, ...conf
}
- settings.zip = path.join(settings.gamepath + "/northstar.zip");
+ settings.zip = path.join(app.getPath("cache"), "vipertmp/northstar.zip");
let args = path.join(settings.gamepath, "ns_startup_args.txt");
if (fs.existsSync(args)) {
diff --git a/src/modules/update.js b/src/modules/update.js
index 82a6df1..534a5af 100644
--- a/src/modules/update.js
+++ b/src/modules/update.js
@@ -161,7 +161,7 @@ update.northstar = async () => {
let ns_version = version.northstar();
const latest_version = await requests.getLatestNsVersion();
- console.log(latest_version)
+
if (latest_version == false) {
ipcMain.emit("ns-update-event", "cli.update.noInternet");
return;
@@ -187,7 +187,20 @@ update.northstar = async () => {
exclude_files();
// start the download of the zip
- https.get(requests.getLatestNsVersionLink(), (res) => {
+ https.get(requests.getLatestNsVersionLink() + "asd", (res) => {
+ let tmp = path.dirname(settings.zip);
+
+ if (fs.existsSync(tmp)) {
+ if (! fs.statSync(tmp).isDirectory()) {
+ fs.rmSync(tmp);
+ }
+ } else {
+ fs.mkdirSync(tmp);
+ if (fs.existsSync(settings.zip)) {
+ fs.rmSync(settings.zip);
+ }
+ }
+
let stream = fs.createWriteStream(settings.zip);
res.pipe(stream);