diff options
Diffstat (limited to 'src/utils.js')
-rw-r--r-- | src/utils.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils.js b/src/utils.js index ba710dc..c89a033 100644 --- a/src/utils.js +++ b/src/utils.js @@ -18,6 +18,7 @@ process.chdir(app.getPath("appData")); var settings = { gamepath: "", lang: "en-US", + autoupdate: true, zip: "/northstar.zip", excludes: [ "ns_startup_args.txt", @@ -125,6 +126,21 @@ function update() { }) } +function updatevp(autoinstall) { + const { autoUpdater } = require("electron-updater"); + + if (autoinstall) { + autoUpdater.on("update-downloaded", (info) => { + autoUpdater.quitAndInstall(); + }); + } + + autoUpdater.on("error", (info) => {cli.exit(1)}); + autoUpdater.on("update-not-available", (info) => {cli.exit()}); + + autoUpdater.checkForUpdatesAndNotify(); +} + function launch(version) { if (process.platform == "linux") { console.error("error:", lang("cli.launch.linuxerror")) @@ -173,6 +189,7 @@ module.exports = { launch, update, setpath, + updatevp, settings, getNSVersion, setlang: (lang) => { |