add buttons in electron to show rns config and meshchat database files in containing folder

This commit is contained in:
liamcottle 2024-07-30 22:56:53 +12:00
commit b7f4123946
3 changed files with 43 additions and 9 deletions

View file

@ -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

View file

@ -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);
},
});