aboutsummaryrefslogtreecommitdiff
path: root/src/modules/mods.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-03-05 00:25:07 +0100
committer0neGal <mail@0negal.com>2023-03-05 00:38:53 +0100
commit5d86a3daa5f762326055469b6bcd8346e0655056 (patch)
tree110fb1395fac1510dc3bf70f39f073df555445ff /src/modules/mods.js
parent4536aad2c4f19d32569d84a7082e8636a2be6985 (diff)
downloadViper-5d86a3daa5f762326055469b6bcd8346e0655056.tar.gz
Viper-5d86a3daa5f762326055469b6bcd8346e0655056.zip
modularized many functions and got rid of utils.js
Notably, winLog() and winAlert() are now win.log() and win.alert() inside modules/window.js. updateViper(), updateNorthstar and handleNorthstarUpdating() are now update.viper(), update.northstar() and update.northstar_autoupdate(), inside modules/update.js isGameRunning() and isOriginRunning() are now is_running.origin() and is_running.game() inside modules/is_running.js, along with a .titanfall() and .northstar() for more specificity. Not used anywhere right now, but may in the future be used. setpath() and gamepathExists() are now gamepath.set() and gamepath.exists() inside modules/gamepath.js killOrigin() are now kill.origin() inside modules/kill.js setlang() is now just inlined into the only event where it's used.
Diffstat (limited to 'src/modules/mods.js')
-rw-r--r--src/modules/mods.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/modules/mods.js b/src/modules/mods.js
index 22865c2..6abed96 100644
--- a/src/modules/mods.js
+++ b/src/modules/mods.js
@@ -6,12 +6,12 @@ const { app, ipcMain } = require("electron");
const { https } = require("follow-redirects");
const json = require("./json");
+const win = require("./window");
const version = require("./version");
const settings = require("./settings");
const cli = require("../cli");
const lang = require("../lang");
-const utils = require("../utils");
var mods = {
installing: [],
@@ -31,7 +31,7 @@ mods.list = () => {
update_path();
if (version.northstar() == "unknown") {
- utils.winLog(lang("general.notinstalled"));
+ win.log(lang("general.notinstalled"));
console.log("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;
@@ -108,7 +108,7 @@ mods.get = (mod) => {
update_path();
if (version.northstar() == "unknown") {
- utils.winLog(lang("general.notinstalled"));
+ win.log(lang("general.notinstalled"));
console.log("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;
@@ -223,14 +223,14 @@ mods.install = (mod, opts) => {
}
if (version.northstar() == "unknown") {
- utils.winLog(lang("general.notinstalled"));
+ win.log(lang("general.notinstalled"));
console.log("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;
}
let notamod = () => {
- utils.winLog(lang("gui.mods.notamod"));
+ win.log(lang("gui.mods.notamod"));
console.log("error: " + lang("cli.mods.notamod"));
cli.exit(1);
return false;
@@ -240,7 +240,7 @@ mods.install = (mod, opts) => {
console.log(lang("cli.mods.installed"));
cli.exit();
- utils.winLog(lang("gui.mods.installedmod"));
+ win.log(lang("gui.mods.installedmod"));
if (modname == "mods") {
let manifest = path.join(app.getPath("userData"), "Archives/manifest.json");
@@ -262,7 +262,7 @@ mods.install = (mod, opts) => {
if (! fs.existsSync(mod)) {return notamod()}
if (fs.statSync(mod).isDirectory()) {
- utils.winLog(lang("gui.mods.installing"));
+ win.log(lang("gui.mods.installing"));
files = fs.readdirSync(mod);
if (fs.existsSync(path.join(mod, "mod.json")) &&
fs.statSync(path.join(mod, "mod.json")).isFile()) {
@@ -351,7 +351,7 @@ mods.install = (mod, opts) => {
return notamod();
}
} else {
- utils.winLog(lang("gui.mods.extracting"));
+ win.log(lang("gui.mods.extracting"));
let cache = path.join(app.getPath("userData"), "Archives");
if (fs.existsSync(cache)) {
fs.rmSync(cache, {recursive: true});
@@ -464,7 +464,7 @@ mods.remove = (mod) => {
update_path();
if (version.northstar() == "unknown") {
- utils.winLog(lang("general.notinstalled"));
+ win.log(lang("general.notinstalled"));
console.log("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;
@@ -525,7 +525,7 @@ mods.toggle = (mod, fork) => {
update_path();
if (version.northstar() == "unknown") {
- utils.winLog(lang("general.notinstalled"));
+ win.log(lang("general.notinstalled"));
console.log("error: " + lang("general.notinstalled"));
cli.exit(1);
return false;