diff options
author | 0neGal <mail@0negal.com> | 2021-12-27 01:10:18 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2021-12-27 01:14:08 +0100 |
commit | ee7753c1e03fe74bc133ecbf7eb149fb53841f58 (patch) | |
tree | c6fa10188cc01c6c1ac31eb50816b5aa6d32e318 /src/index.js | |
parent | df7b714d27e5d23a6ac3e381e6684856bc818d1c (diff) | |
download | Viper-ee7753c1e03fe74bc133ecbf7eb149fb53841f58.tar.gz Viper-ee7753c1e03fe74bc133ecbf7eb149fb53841f58.zip |
added working cli arguments
I think?
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/index.js b/src/index.js index 5586633..9fe7610 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,11 @@ const fs = require("fs"); const path = require("path"); const { app, dialog, ipcMain, BrowserWindow } = require("electron"); -const utils = require("./utils") +const Emitter = require("events"); +const events = new Emitter(); + +const utils = require("./utils"); +const cli = require("./cli"); function start() { win = new BrowserWindow({ @@ -20,12 +24,19 @@ function start() { win.loadFile(__dirname + "/app/index.html"); win.webContents.once("dom-ready", () => {win.show()}); - ipcMain.on("update", (event) => {utils.update(win)}) ipcMain.on("setpath", (event) => {utils.setpath(win)}) } -app.on("ready", () => { - process.chdir(app.getPath("appData")); - app.setPath("userData", path.join(app.getPath("cache"), app.name)); - start(); -}) +ipcMain.on("setpathcli", (event) => {utils.setpath()}) +ipcMain.on("update", (event) => {utils.update()}) + +process.chdir(app.getPath("appData")); + +if (cli.hasArgs()) { + cli.init(); +} else { + app.on("ready", () => { + app.setPath("userData", path.join(app.getPath("cache"), app.name)); + start(); + }) +} |