🐛 Add support for Mac and Open Folder dialog.

This commit is contained in:
David Elliott
2016-04-29 08:20:52 -07:00
parent 398ae4491e
commit e2fa948ac8
2 changed files with 11 additions and 6 deletions

View File

@@ -255,9 +255,9 @@ class AtomApplication
ipcMain.on 'open-command', (event, command, args...) =>
defaultPath = args[0] if args.length > 0
switch command
when 'application:open' then @promptForPathToOpen('all', getLoadSettings())
when 'application:open' then @promptForPathToOpen('all', getLoadSettings(), defaultPath)
when 'application:open-file' then @promptForPathToOpen('file', getLoadSettings(), defaultPath)
when 'application:open-folder' then @promptForPathToOpen('folder', getLoadSettings())
when 'application:open-folder' then @promptForPathToOpen('folder', getLoadSettings(), defaultPath)
else console.log "Invalid open-command received: " + command
ipcMain.on 'window-command', (event, command, args...) ->
@@ -688,7 +688,7 @@ class AtomApplication
else 'Open'
# File dialog defaults to project directory of currently active editor
if path? and type is 'file'
if path?
openOptions.defaultPath = path
dialog.showOpenDialog(parentWindow, openOptions, callback)

View File

@@ -1,6 +1,7 @@
{ipcRenderer} = require 'electron'
module.exports = ({commandRegistry, commandInstaller, config, notificationManager}) ->
commandRegistry.add 'atom-workspace',
'pane:show-next-recently-used-item': -> @getModel().getActivePane().activateNextRecentlyUsedItem()
'pane:show-previous-recently-used-item': -> @getModel().getActivePane().activatePreviousRecentlyUsedItem()
@@ -31,11 +32,15 @@ module.exports = ({commandRegistry, commandInstaller, config, notificationManage
'application:unhide-all-applications': -> ipcRenderer.send('command', 'application:unhide-all-applications')
'application:new-window': -> ipcRenderer.send('command', 'application:new-window')
'application:new-file': -> ipcRenderer.send('command', 'application:new-file')
'application:open': -> ipcRenderer.send('open-command', 'application:open')
'application:open-file': ->
'application:open': ->
defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
ipcRenderer.send('open-command', 'application:open', defaultPath)
'application:open-file': ->
defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
ipcRenderer.send('open-command', 'application:open-file', defaultPath)
'application:open-folder': -> ipcRenderer.send('open-command', 'application:open-folder')
'application:open-folder': ->
defaultPath = atom.workspace.getActiveTextEditor()?.getPath() ? atom.project.getPaths()?[0]
ipcRenderer.send('open-command', 'application:open-folder', defaultPath)
'application:open-dev': -> ipcRenderer.send('command', 'application:open-dev')
'application:open-safe': -> ipcRenderer.send('command', 'application:open-safe')
'application:add-project-folder': -> atom.addProjectFolder()