diff --git a/app/src/lib/types.ts b/app/src/lib/types.ts index 762c86e..f23a686 100644 --- a/app/src/lib/types.ts +++ b/app/src/lib/types.ts @@ -2,6 +2,7 @@ export enum CHANNELS { ACTION_NEW = 'ACTION_NEW', ALERT = 'ALERT', GET_GAME_DIR = 'GET_GAME_DIR', + OPEN_GAME_DIR = 'OPEN_GAME_DIR', SET_IS_ALWAYS_ON_TOP = 'TOGGLE_ALWAYS_ON_TOP', } diff --git a/app/src/main/ipcHandlers.ts b/app/src/main/ipcHandlers.ts index 106cf23..185922d 100644 --- a/app/src/main/ipcHandlers.ts +++ b/app/src/main/ipcHandlers.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, ipcMain } from 'electron'; +import { BrowserWindow, ipcMain, shell } from 'electron'; import getGameDirectory from '../lib/node/utils/getGameDirectory'; import { CHANNELS } from '../lib/types'; @@ -8,10 +8,13 @@ export type SetItAlwaysOnTopResponse = { }; export function attachIpcHandlers() { - /** @method CHANNELS.GET_GAME_DIR */ ipcMain.handle(CHANNELS.GET_GAME_DIR, () => { return getGameDirectory(); }); + ipcMain.handle(CHANNELS.OPEN_GAME_DIR, () => { + shell.openPath(getGameDirectory()); + return; + }); ipcMain.handle(CHANNELS.SET_IS_ALWAYS_ON_TOP, (_, isAlwaysOnTop: boolean) => { console.log('Toggling always on top'); const window = BrowserWindow.getFocusedWindow(); diff --git a/app/src/preload/api.ts b/app/src/preload/api.ts index 57c56c9..6c46a1a 100644 --- a/app/src/preload/api.ts +++ b/app/src/preload/api.ts @@ -14,7 +14,7 @@ const api = { return await ipcRenderer.invoke(CHANNELS.GET_GAME_DIR); }, openGameDirectory: async () => { - shell.openPath(await ipcRenderer.invoke(CHANNELS.GET_GAME_DIR)); + return await ipcRenderer.invoke(CHANNELS.OPEN_GAME_DIR); }, setIsAlwaysOnTop: async (isAlwaysOnTop: boolean) => { return (await ipcRenderer.invoke( diff --git a/app/src/renderer/app/App.svelte b/app/src/renderer/app/App.svelte index bbffbda..b8df657 100644 --- a/app/src/renderer/app/App.svelte +++ b/app/src/renderer/app/App.svelte @@ -70,8 +70,9 @@ Using logs from{' '}