diff options
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/index.js b/src/index.js index 0babcea..5586633 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,8 @@ const fs = require("fs"); const path = require("path"); const { app, dialog, ipcMain, BrowserWindow } = require("electron"); +const utils = require("./utils") + function start() { win = new BrowserWindow({ width: 500, @@ -18,13 +20,8 @@ function start() { win.loadFile(__dirname + "/app/index.html"); win.webContents.once("dom-ready", () => {win.show()}); - ipcMain.on("setpath", (event) => { - dialog.showOpenDialog({properties: ["openDirectory"]}).then(res => { - fs.writeFileSync(app.getPath("appData") + "/viper.json", JSON.stringify({path: res.filePaths[0]})) - - win.webContents.send("newpath", res.filePaths[0]); - }).catch(err => {console.error(err)}) - }) + ipcMain.on("update", (event) => {utils.update(win)}) + ipcMain.on("setpath", (event) => {utils.setpath(win)}) } app.on("ready", () => { |