Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1311 from mattlubner/master
Browse files Browse the repository at this point in the history
♿️ Restore platform-centric menu names for showing in file manager
  • Loading branch information
50Wliu committed Apr 18, 2019
2 parents 9144478 + 319c7fc commit 9b2d459
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
13 changes: 11 additions & 2 deletions lib/tree-view.coffee
Expand Up @@ -560,13 +560,22 @@ class TreeView
return unless filePath = @selectedEntry()?.getPath()

unless shell.showItemInFolder(filePath)
atom.notifications.addWarning("Unable to show #{filePath} in file manager")
atom.notifications.addWarning("Unable to show #{filePath} in #{@getFileManagerName()}")

showCurrentFileInFileManager: ->
return unless filePath = atom.workspace.getCenter().getActiveTextEditor()?.getPath()

unless shell.showItemInFolder(filePath)
atom.notifications.addWarning("Unable to show #{filePath} in file manager")
atom.notifications.addWarning("Unable to show #{filePath} in #{@getFileManagerName()}")

getFileManagerName: ->
switch process.platform
when 'darwin'
return 'Finder'
when 'win32'
return 'Explorer'
else
return 'File Manager'

openSelectedEntryInNewWindow: ->
if pathToOpen = @selectedEntry()?.getPath()
Expand Down
34 changes: 32 additions & 2 deletions menus/tree-view.cson
Expand Up @@ -39,7 +39,6 @@
{'label': 'Copy Full Path', 'command': 'tree-view:copy-full-path'}
{'label': 'Copy Project Path', 'command': 'tree-view:copy-project-path'}
{'label': 'Open in New Window', 'command': 'tree-view:open-in-new-window'}
{'label': 'Show in File Manager', 'command': 'tree-view:show-in-file-manager'}
]

'.tree-view .full-menu [is="tree-view-file"]': [
Expand Down Expand Up @@ -73,6 +72,18 @@
{'label': 'Open in New Window', 'command': 'tree-view:open-in-new-window'}
]

'.platform-darwin .tree-view .full-menu': [
{'label': 'Reveal in Finder', 'command': 'tree-view:show-in-file-manager'}
]

'.platform-win32 .tree-view .full-menu': [
{'label': 'Show in Explorer', 'command': 'tree-view:show-in-file-manager'}
]

'.platform-linux .tree-view .full-menu': [
{'label': 'Show in File Manager', 'command': 'tree-view:show-in-file-manager'}
]

'.tree-view .multi-select': [
{'label': 'Delete', 'command': 'tree-view:remove'}
{'label': 'Copy', 'command': 'tree-view:copy'}
Expand All @@ -87,9 +98,28 @@
'atom-pane[data-active-item-path] .tab.active': [
{'label': 'Rename', 'command': 'tree-view:rename'}
{'label': 'Reveal in Tree View', 'command': 'tree-view:reveal-active-file'}
]

'.platform-darwin atom-pane[data-active-item-path] .tab.active': [
{'label': 'Reveal In Finder', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'.platform-win32 atom-pane[data-active-item-path] .tab.active': [
{'label': 'Show In Explorer', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'.platform-linux atom-pane[data-active-item-path] .tab.active': [
{'label': 'Show in File Manager', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'atom-text-editor:not([mini])': [
'.platform-darwin atom-text-editor:not([mini])': [
{'label': 'Reveal In Finder', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'.platform-win32 atom-text-editor:not([mini])': [
{'label': 'Show In Explorer', 'command': 'tree-view:show-current-file-in-file-manager'}
]

'.platform-linux atom-text-editor:not([mini])': [
{'label': 'Show in File Manager', 'command': 'tree-view:show-current-file-in-file-manager'}
]

0 comments on commit 9b2d459

Please sign in to comment.