From 9d4197b23744947ff98977388d81ccf51f20e66e Mon Sep 17 00:00:00 2001 From: Maarten <50550545+mmvanheusden@users.noreply.github.com> Date: Sat, 23 Dec 2023 11:31:17 +0100 Subject: [PATCH] refactor: export mainWindow --- main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index b593e6c3..d4a9023a 100644 --- a/main.js +++ b/main.js @@ -1,9 +1,10 @@ const {app, BrowserWindow, dialog, ipcMain} = require("electron") const {platformpath} = require("./utils") +let mainWindow const createWindow = () => { // Create the browser window. - const mainWindow = new BrowserWindow({ + mainWindow = new BrowserWindow({ autoHideMenuBar: true, resizable: false, width: 445, @@ -57,7 +58,7 @@ app.on("window-all-closed", () => { ipcMain.on("selectpath", (event) => { - dialog.showOpenDialog(BrowserWindow.getFocusedWindow(), { + dialog.showOpenDialog(mainWindow, { // Specifying the Directory Selector Property properties: ["openDirectory"], title: "Select the path where the game will be downloaded",