diff --git a/electron/main.js b/electron/main.js index 223fcf3..c2a591f 100644 --- a/electron/main.js +++ b/electron/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, dialog, ipcMain, systemPreferences } = require('electron'); +const { app, BrowserWindow, dialog, ipcMain, shell, systemPreferences } = require('electron'); const electronPrompt = require('electron-prompt'); const { spawn } = require('child_process'); const fs = require('fs'); @@ -11,7 +11,7 @@ var mainWindow = null; var exeChildProcess = null; // allow fetching app version via ipc -ipcMain.handle('app-version', async() => { +ipcMain.handle('app-version', () => { return app.getVersion(); }); @@ -36,11 +36,16 @@ ipcMain.handle('prompt', async(event, message) => { }); // allow relaunching app via ipc -ipcMain.handle('relaunch', async() => { +ipcMain.handle('relaunch', () => { app.relaunch(); app.exit(); }); +// allow showing a file path in os file manager +ipcMain.handle('showPathInFolder', (event, path) => { + shell.showItemInFolder(path); +}); + function log(message) { // make sure main window exists diff --git a/electron/preload.js b/electron/preload.js index 74854cf..8abc460 100644 --- a/electron/preload.js +++ b/electron/preload.js @@ -25,4 +25,9 @@ contextBridge.exposeInMainWorld('electron', { return await ipcRenderer.invoke('relaunch'); }, + // allow showing a file path in os file manager + showPathInFolder: async function(path) { + return await ipcRenderer.invoke('showPathInFolder', path); + }, + }); diff --git a/public/index.html b/public/index.html index 486ec4b..26dafe7 100644 --- a/public/index.html +++ b/public/index.html @@ -1298,13 +1298,27 @@