mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-05 03:36:35 +00:00
ATL-1451: reveal sketch directory in file explorer (#450)
This commit is contained in:
parent
e10f0f1683
commit
4e6f9ae75d
@ -1,4 +1,4 @@
|
||||
import { shell } from 'electron';
|
||||
import { remote } from 'electron';
|
||||
import { inject, injectable } from 'inversify';
|
||||
import { CommandRegistry } from '@theia/core/lib/common/command';
|
||||
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
|
||||
@ -22,6 +22,7 @@ import {
|
||||
} from '@theia/core/lib/common/disposable';
|
||||
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
|
||||
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
||||
import { URI } from '../../contributions/contribution';
|
||||
|
||||
export const SKETCHBOOK__CONTEXT = ['arduino-sketchbook--context'];
|
||||
|
||||
@ -104,8 +105,16 @@ export class SketchbookWidgetContribution
|
||||
});
|
||||
|
||||
registry.registerCommand(SketchbookCommands.REVEAL_IN_FINDER, {
|
||||
execute: (arg) => {
|
||||
shell.openPath(arg.node.id);
|
||||
execute: async (arg) => {
|
||||
if (arg.node.uri) {
|
||||
const exists = await this.fileService.exists(new URI(arg.node.uri));
|
||||
if (exists) {
|
||||
const fsPath = await this.fileService.fsPath(new URI(arg.node.uri));
|
||||
if (fsPath) {
|
||||
remote.shell.openPath(fsPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
isEnabled: (arg) =>
|
||||
!!arg && 'node' in arg && SketchbookTree.SketchDirNode.is(arg.node),
|
||||
|
Loading…
x
Reference in New Issue
Block a user