Adding some final details

This commit is contained in:
X3F200C 2023-08-09 13:00:08 -04:00
parent 3e5e0c56cf
commit fce163a8b0
2 changed files with 18 additions and 13 deletions

View File

@ -163,8 +163,6 @@ async function checkFiles() {
if (sum !== file.hash) { if (sum !== file.hash) {
console.log("\x1b[33mFile " + file.name + " needs to be updated.\x1b[0m"); console.log("\x1b[33mFile " + file.name + " needs to be updated.\x1b[0m");
filesToDownload.push(file); 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 file = files[f];
var filePath = path.join(basePath, ...(file.name.split("/"))); 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); await httpsDownload(file.baseUrl + file.hash, filePath);
} }
@ -185,8 +183,7 @@ async function downloadFiles(files) {
} }
function launchLauncher() { 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, [], { var subprocess = child_process.spawn(launcherPath, [], {
@ -196,9 +193,18 @@ function launchLauncher() {
subprocess.on("spawn", function () { subprocess.on("spawn", function () {
subprocess.unref(); subprocess.unref();
resolve();
});
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 () { (async function () {
var manifestCount = mustSkipCustom ? 1 : manifestURLs.length; 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); console.error("An error has occurred while downloading a file. \n" + error.stack);
}); });
} else { } else {
// console.log("All files seem good ! ");
launchLauncher().then(function () { launchLauncher().then(function () {
}).catch(function (error) { }).catch(function (error) {

View File

@ -1,7 +1,7 @@
{ {
"name": "open-plutonium-updater", "name": "open-plutonium-updater",
"description": "Updater for Kroniker Project's version of Plutonium Black Ops II", "description": "Updater for Kroniker Project's version of Plutonium Black Ops II",
"version": "0.4.0", "version": "0.4.2",
"main": "index.js", "main": "index.js",
"author": "X3F200C", "author": "X3F200C",
"license": "GPL-3.0" "license": "GPL-3.0"