File tree 1 file changed +12
-3
lines changed
arduino-ide-extension/src/browser/widgets/sketchbook
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
- import { shell } from 'electron' ;
1
+ import { remote } from 'electron' ;
2
2
import { inject , injectable } from 'inversify' ;
3
3
import { CommandRegistry } from '@theia/core/lib/common/command' ;
4
4
import { MenuModelRegistry } from '@theia/core/lib/common/menu' ;
@@ -22,6 +22,7 @@ import {
22
22
} from '@theia/core/lib/common/disposable' ;
23
23
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl' ;
24
24
import { FileService } from '@theia/filesystem/lib/browser/file-service' ;
25
+ import { URI } from '../../contributions/contribution' ;
25
26
26
27
export const SKETCHBOOK__CONTEXT = [ 'arduino-sketchbook--context' ] ;
27
28
@@ -104,8 +105,16 @@ export class SketchbookWidgetContribution
104
105
} ) ;
105
106
106
107
registry . registerCommand ( SketchbookCommands . REVEAL_IN_FINDER , {
107
- execute : ( arg ) => {
108
- shell . openPath ( arg . node . id ) ;
108
+ execute : async ( arg ) => {
109
+ if ( arg . node . uri ) {
110
+ const exists = await this . fileService . exists ( new URI ( arg . node . uri ) ) ;
111
+ if ( exists ) {
112
+ const fsPath = await this . fileService . fsPath ( new URI ( arg . node . uri ) ) ;
113
+ if ( fsPath ) {
114
+ remote . shell . openPath ( fsPath ) ;
115
+ }
116
+ }
117
+ }
109
118
} ,
110
119
isEnabled : ( arg ) =>
111
120
! ! arg && 'node' in arg && SketchbookTree . SketchDirNode . is ( arg . node ) ,
You can’t perform that action at this time.
0 commit comments