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' ;
@@ -25,6 +25,7 @@ import {
25
25
} from '@theia/core/lib/common/disposable' ;
26
26
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl' ;
27
27
import { FileService } from '@theia/filesystem/lib/browser/file-service' ;
28
+ import { URI } from '../../contributions/contribution' ;
28
29
29
30
export const SKETCHBOOK__CONTEXT = [ 'arduino-sketchbook--context' ] ;
30
31
@@ -111,8 +112,16 @@ export class SketchbookWidgetContribution
111
112
} ) ;
112
113
113
114
registry . registerCommand ( SketchbookCommands . REVEAL_IN_FINDER , {
114
- execute : ( arg ) => {
115
- shell . openPath ( arg . node . id ) ;
115
+ execute : async ( arg ) => {
116
+ if ( arg . node . uri ) {
117
+ const exists = await this . fileService . exists ( new URI ( arg . node . uri ) ) ;
118
+ if ( exists ) {
119
+ const fsPath = await this . fileService . fsPath ( new URI ( arg . node . uri ) ) ;
120
+ if ( fsPath ) {
121
+ remote . shell . openPath ( fsPath ) ;
122
+ }
123
+ }
124
+ }
116
125
} ,
117
126
isEnabled : ( arg ) =>
118
127
! ! arg && 'node' in arg && SketchbookTree . SketchDirNode . is ( arg . node ) ,
You can’t perform that action at this time.
0 commit comments