From f6f940a976702a8dfb97cb2f53754faf774ad2cc Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Sat, 8 Jan 2022 16:09:53 +0100 Subject: [fix] displaying northstar version on first launch Previously, on first viper launch, northstar version was parsed even before game path was selected, leading to "unknown" being systematically displayed on first launch. Now, when a game path is set, versions are automatically updated. --- src/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 53781dd..e421fd1 100644 --- a/src/index.js +++ b/src/index.js @@ -59,7 +59,7 @@ ipcMain.on("update", (event) => {utils.update()}) ipcMain.on("setpathcli", (event) => {utils.setpath()}); ipcMain.on("setpath", (event, value) => { if (!value) { - utils.setpath(win) + utils.setpath(win); } else if (!win.isVisible()) { win.show(); } @@ -68,6 +68,7 @@ ipcMain.on("newpath", (event, newpath) => { if (newpath === false && !win.isVisible()) { win.webContents.send("nopathselected"); } else { + _sendVersionsInfo(); if (!win.isVisible()) { win.show(); } @@ -76,12 +77,14 @@ ipcMain.on("newpath", (event, newpath) => { win.webContents.send("wrongpath"); }); -ipcMain.on("getversion", () => { +function _sendVersionsInfo() { win.webContents.send("version", { ns: utils.getNSVersion(), vp: "v" + require("../package.json").version }); -}); +} + +ipcMain.on("getversion", () => _sendVersionsInfo()); ipcMain.on("versioncli", () => { console.log("Viper: v" + require("../package.json").version); -- cgit v1.2.3