From 18d8dce5388cd48a34b52f2cb5e7accde3a42b15 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sun, 4 Feb 2024 23:25:51 +0100 Subject: 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. --- src/index.js | 11 ++++++----- 1 file 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(); }) } -- cgit v1.2.3