aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2024-02-04 23:25:51 +0100
committer0neGal <mail@0negal.com>2024-02-04 23:25:51 +0100
commit18d8dce5388cd48a34b52f2cb5e7accde3a42b15 (patch)
treea8b4175785a0d928bf8ebb1309620bd6faf44e47 /src
parentc60d4d7aec2985fbf9bddff15c0cc379af6ef226 (diff)
downloadViper-18d8dce5388cd48a34b52f2cb5e7accde3a42b15.tar.gz
Viper-18d8dce5388cd48a34b52f2cb5e7accde3a42b15.zip
fixed setting cache folder too late
We set the Electron path `userData` to the system's cache folder, as this is the same path Electron stores cache files in, and its normally set to the system config folder, obviously not ideal. However, when changing, we do as such quite late in the startup process leading to some things (notably the variable used to store where we download the Northstar archive to), using the older value. Now its one of the first things we do on startup, fixing that.
Diffstat (limited to 'src')
-rw-r--r--src/index.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/index.js b/src/index.js
index 358723f..9321598 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,6 +1,11 @@
const path = require("path");
const { app, BrowserWindow } = require("electron");
+// makes it so Electron cache doesn't get stored in your system's config
+// folder, and instead changing it over to using the system's cache
+// folder instead
+app.setPath("userData", path.join(app.getPath("cache"), app.name));
+
// ensures PWD/CWD is the config folder where viper.json is located
process.chdir(app.getPath("appData"));
@@ -107,13 +112,9 @@ if (cli.hasArgs()) {
cli.init();
}
} else {
+ // start the window/GUI
app.on("ready", () => {
- // makes it so Electron cache doesn't get stored in your system
- // config folder, changing it over to actually using the system
- // cache folder instead
- app.setPath("userData", path.join(app.getPath("cache"), app.name));
- // start the window/GUI
start();
})
}