diff --git a/index.js b/index.js index b5c5125..70e4004 100644 --- a/index.js +++ b/index.js @@ -163,8 +163,6 @@ async function checkFiles() { if (sum !== file.hash) { console.log("\x1b[33mFile " + file.name + " needs to be updated.\x1b[0m"); filesToDownload.push(file); - } else { - // console.log("File " + file.name + " doesn't need to be downloaded again. "); } } @@ -176,7 +174,7 @@ async function downloadFiles(files) { var file = files[f]; var filePath = path.join(basePath, ...(file.name.split("/"))); - console.log("Downloading file " + file.name + "..."); + console.log("\x1b[35mDownloading file " + file.name + "...\x1b[0m"); await httpsDownload(file.baseUrl + file.hash, filePath); } @@ -185,20 +183,28 @@ async function downloadFiles(files) { } function launchLauncher() { - // console.log("Launching the launcher ! "); + return new Promise(function (resolve, reject) { + var launcherPath = path.join(basePath, "bin", "plutonium-launcher-win32.exe"); - var launcherPath = path.join(basePath, "bin", "plutonium-launcher-win32.exe"); + var subprocess = child_process.spawn(launcherPath, [], { + "detached": true, + "stdio": "ignore" + }); - var subprocess = child_process.spawn(launcherPath, [], { - "detached": true, - "stdio": "ignore" - }); + subprocess.on("spawn", function () { + subprocess.unref(); + resolve(); + }); - subprocess.on("spawn", function () { - subprocess.unref(); + subprocess.on("error", function (error) { + reject(error); + }); }); } +process.title = "Kroniker Updater - Plutonium Black Ops II"; +process.stdout.write("\x1b]0;Kroniker Updater - Plutonium Black Ops II\x07"); + (async function () { var manifestCount = mustSkipCustom ? 1 : manifestURLs.length; @@ -224,7 +230,6 @@ function launchLauncher() { console.error("An error has occurred while downloading a file. \n" + error.stack); }); } else { - // console.log("All files seem good ! "); launchLauncher().then(function () { }).catch(function (error) { diff --git a/package.json b/package.json index 47971c4..76bd759 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "open-plutonium-updater", "description": "Updater for Kroniker Project's version of Plutonium Black Ops II", - "version": "0.4.0", + "version": "0.4.2", "main": "index.js", "author": "X3F200C", "license": "GPL-3.0"