提交 fc5f80e1 编写于 作者: B Benjamin Pasero

title - better simulate mac behaviour when opening path from title

上级 7403c72f
......@@ -99,8 +99,21 @@ export class TitlebarPart extends Part implements ITitleService {
if (this.representedFileName) {
const segments = this.representedFileName.split(paths.sep);
for (let i = segments.length; i > 0; i--) {
const path = segments.slice(0, i).join(paths.sep);
actions.push(new ShowItemInFolderAction(path, this.windowsService));
const isFile = (i === segments.length);
let pathOffset = i;
if (!isFile) {
pathOffset++; // for segments which are not the file name we want to open the folder
}
const path = segments.slice(0, pathOffset).join(paths.sep);
let label = paths.basename(path);
if (!isFile) {
label = paths.basename(paths.dirname(path));
}
actions.push(new ShowItemInFolderAction(path, label || paths.sep, this.windowsService));
}
}
......@@ -143,8 +156,8 @@ export class TitlebarPart extends Part implements ITitleService {
class ShowItemInFolderAction extends Action {
constructor(private path: string, private windowsService: IWindowsService) {
super('showItemInFolder.action.id', paths.basename(path) || paths.sep);
constructor(private path: string, label: string, private windowsService: IWindowsService) {
super('showItemInFolder.action.id', label);
}
public run(): TPromise<void> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册