aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2021-12-28 16:46:09 +0100
committer0neGal <mail@0negal.com>2021-12-28 16:46:09 +0100
commitbce88c1def1b0d8c8f03595c6a84196173304f34 (patch)
tree7b5947439efb560b98faee5a532acb93517a0de8
parentb2bdedddad5001db625478f91ff5d8e86b79f87d (diff)
downloadViper-bce88c1def1b0d8c8f03595c6a84196173304f34.tar.gz
Viper-bce88c1def1b0d8c8f03595c6a84196173304f34.zip
you can now exclude certain files like, ns_args
However, I can't figure out a way to directly exclude it in the unzip package, hence, it just renames the original to "<file>.excluded" when the extraction is done it then renames it back to it's original aka "<file>", overwriting what was extracted, which essentially excludes some files. If there exists an unzip library/package that has options for excluding files we should move to that, but until something as such is found the current way is how we'll do it.
-rw-r--r--src/app/main.js4
-rw-r--r--src/utils.js19
2 files changed, 23 insertions, 0 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 17389b2..be13beb 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -6,6 +6,10 @@ var settings = {
gamepath: "",
file: "viper.json",
zip: "/northstar.zip",
+ excludes: [
+ "ns_startup_args.txt",
+ "ns_startup_args_dedi.txt"
+ ]
}
if (fs.existsSync(settings.file)) {
diff --git a/src/utils.js b/src/utils.js
index 85cc26e..a5cb461 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -18,6 +18,10 @@ var settings = {
gamepath: "",
file: "viper.json",
zip: "/northstar.zip",
+ excludes: [
+ "ns_startup_args.txt",
+ "ns_startup_args_dedi.txt"
+ ]
}
if (fs.existsSync(settings.file)) {
@@ -45,6 +49,13 @@ function setpath(win) {
}
function update() {
+ for (let i = 0; i < settings.excludes.length; i++) {
+ let exclude = path.join(settings.gamepath + "/" + settings.excludes[i]);
+ if (fs.existsSync(exclude)) {
+ fs.renameSync(exclude, exclude + ".excluded")
+ }
+ }
+
console.log("Downloading...");
request({
json: true,
@@ -61,6 +72,14 @@ function update() {
.on("finish", () => {
console.log("Installation/Update finished!");
events.emit("updated");
+
+ 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)
+ }
+ }
+
cli.exit();
});
})