File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 66
66
"electron" : " ^28.2.1" ,
67
67
"hadron-app-registry" : " ^9.1.6" ,
68
68
"hadron-document" : " ^8.4.7" ,
69
+ "hadron-ipc" : " ^3.2.10" ,
69
70
"mongodb-data-service" : " ^22.17.4" ,
70
71
"react" : " ^17.0.2"
71
72
},
80
81
"electron" : " ^28.2.1" ,
81
82
"hadron-app-registry" : " ^9.1.6" ,
82
83
"hadron-document" : " ^8.4.7" ,
84
+ "hadron-ipc" : " ^3.2.10" ,
83
85
"mongodb-data-service" : " ^22.17.4"
84
86
},
85
87
"devDependencies" : {
Original file line number Diff line number Diff line change 3
3
* to a highlighted path of `fileName` (e.g. "Show in Finder" on macOS)
4
4
* using the builtin electron API.
5
5
**/
6
+ import { ipcRenderer } from 'hadron-ipc' ;
7
+
6
8
export default function revealFile ( fileName : string ) {
7
- // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/consistent-type-imports
8
- const { shell } : typeof import ( 'electron' ) = require ( 'electron' ) ;
9
- shell . showItemInFolder ( fileName ) ;
9
+ // electron.shell.showItemInFolder(filename); was crashing Finder on macOS
10
+ // when called from the renderer process. Doing it on main rather seems to
11
+ // work fine.
12
+ ipcRenderer ?. send ( 'show-file' , fileName ) ;
10
13
}
Original file line number Diff line number Diff line change @@ -351,6 +351,10 @@ class CompassWindowManager {
351
351
'test:show-connect-window' : ( ) => showConnectWindow ( compassApp ) ,
352
352
} ) ;
353
353
354
+ ipcMain ?. on ( 'show-file' , ( evt , filename : string ) => {
355
+ shell . showItemInFolder ( filename ) ;
356
+ } ) ;
357
+
354
358
await electronApp . whenReady ( ) ;
355
359
await onAppReady ( ) ;
356
360
You can’t perform that action at this time.
0 commit comments