Skip to content

Commit

Permalink
Add bridge for openPath (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelboca authored Aug 30, 2024
1 parent e6f8170 commit d01edfb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion desktop/bridge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ipcMain, dialog, app } from 'electron'
import { ipcMain, dialog, app, shell } from 'electron'
import log from 'electron-log'

export function createBridge() {
Expand All @@ -25,6 +25,10 @@ export function createBridge() {
}
})

ipcMain.on('openPathInExplorer', (_event, path) => {
shell.openPath(path)
})

ipcMain.handle('closeDesktopApp', async () => {
app.quit()
})
Expand Down
5 changes: 3 additions & 2 deletions desktop/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { contextBridge, ipcRenderer } from 'electron'
contextBridge.exposeInMainWorld('opendataeditor', {
sendFatalError: (message: string) => ipcRenderer.invoke('sendFatalError', message),
openDirectoryDialog: () => ipcRenderer.invoke('openDirectoryDialog'),
ensureLogs: (callback: any) =>
ipcRenderer.on('ensureLogs', (_event, message: string) => callback(message)),

ensureLogs: (callback: any) => ipcRenderer.on('ensureLogs', (_event, message: string) => callback(message)),
openPathInExplorer: (path: string) => ipcRenderer.send('openPathInExplorer', path),
closeDesktopApp: () => ipcRenderer.invoke('closeDesktopApp'),
})

0 comments on commit d01edfb

Please sign in to comment.