diff options
author | Alystrasz <contact@remyraes.com> | 2022-02-12 23:11:52 +0100 |
---|---|---|
committer | Alystrasz <contact@remyraes.com> | 2022-02-12 23:11:52 +0100 |
commit | 564694b47e8218b7b9991c844160c0c33d536256 (patch) | |
tree | f4a229d846546d669606f6224d03b186533eb64c | |
parent | bdc9712634a77689150c2577e785419a7c13365a (diff) | |
download | Viper-564694b47e8218b7b9991c844160c0c33d536256.tar.gz Viper-564694b47e8218b7b9991c844160c0c33d536256.zip |
[feat] at start, restore excluded files who might have been created by an incomplete update process
-rw-r--r-- | src/utils.js | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/utils.js b/src/utils.js index 5761558..1448007 100644 --- a/src/utils.js +++ b/src/utils.js @@ -202,6 +202,19 @@ function getTF2Version() { } } + +// Renames excluded files to their original name +function restoreExcludedFiles() { + for (let i = 0; i < settings.excludes.length; i++) { + let exclude = path.join(settings.gamepath + "/" + settings.excludes[i]); + if (fs.existsSync(exclude + ".excluded")) { + fs.renameSync(exclude + ".excluded", exclude) + } + } +} +// At start, restore excluded files who might have been created by an incomplete update process. +restoreExcludedFiles(); + // Installs/Updates Northstar // // If Northstar is already installed it'll be an update, otherwise it'll @@ -263,16 +276,10 @@ async function update() { // installing Northstar. fs.createReadStream(settings.zip).pipe(unzip.Extract({path: settings.gamepath})) .on("finish", () => { - fs.writeFileSync(path.join(settings.gamepath, "ns_version.txt"), latestAvailableVersion); - ipcMain.emit("getversion"); - - // Renames excluded files to their original name - for (let i = 0; i < settings.excludes.length; i++) { - let exclude = path.join(settings.gamepath + "/" + settings.excludes[i]); - if (fs.existsSync(exclude + ".excluded")) { - fs.renameSync(exclude + ".excluded", exclude) - } - } + fs.writeFileSync(path.join(settings.gamepath, "ns_version.txt"), latestAvailableVersion); + ipcMain.emit("getversion"); + + restoreExcludedFiles(); ipcMain.emit("guigetmods"); ipcMain.emit("ns-update-event", "cli.update.uptodate.short"); |