aboutsummaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-01-05 00:37:38 +0100
committer0neGal <mail@0negal.com>2022-01-05 00:37:38 +0100
commita898d6866a912abceb78832bc1b3fe2ff56d1335 (patch)
tree9067a550a1f110b37cfa8cd99ce7a80b156c442d /src/index.js
parentdce0f68e7f9095ffa400112f03968251999a92dc (diff)
parent89d8d1986b62d5686160f28359383ccd0c67f77d (diff)
downloadViper-a898d6866a912abceb78832bc1b3fe2ff56d1335.tar.gz
Viper-a898d6866a912abceb78832bc1b3fe2ff56d1335.zip
Merge branch 'main' of 0neGal/viper into mod-support
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/index.js b/src/index.js
index a723622..1a9f660 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,7 +1,7 @@
const fs = require("fs");
const path = require("path");
const { autoUpdater } = require("electron-updater");
-const { app, dialog, ipcMain, BrowserWindow, ipcRenderer } = require("electron");
+const { app, ipcMain, BrowserWindow } = require("electron");
const Emitter = require("events");
const events = new Emitter();
@@ -31,12 +31,8 @@ function start() {
win.loadFile(__dirname + "/app/index.html");
ipcMain.on("exit", () => {process.exit(0)})
- ipcMain.on("setpath", () => {utils.setpath(win)})
ipcMain.on("setsize", (event, height) => {
win.setSize(width, height);
- if (! win.isVisible()) {
- win.show();
- }
})
ipcMain.on("ns-updated", () => {win.webContents.send("ns-updated")})
@@ -74,6 +70,22 @@ ipcMain.on("launchVanilla", (event) => {utils.launch("vanilla")})
ipcMain.on("update", (event) => {utils.update()})
ipcMain.on("setpathcli", (event) => {utils.setpath()});
+ipcMain.on("setpath", (event, value) => {
+ if (!value) {
+ utils.setpath(win)
+ } else if (!win.isVisible()) {
+ win.show();
+ }
+});
+ipcMain.on("newpath", (event, newpath) => {
+ if (newpath === false && !win.isVisible()) {
+ win.webContents.send("nopathselected");
+ } else {
+ if (!win.isVisible()) {
+ win.show();
+ }
+ }
+});
ipcMain.on("getversion", () => {
win.webContents.send("version", {