Make atom.open work with parameters.

This commit is contained in:
Cheng Zhao
2013-05-25 14:38:04 +08:00
parent 0cdbfed7ab
commit 462bd77ad5
2 changed files with 8 additions and 9 deletions

View File

@@ -153,11 +153,8 @@ window.atom =
themeNames = config.get("core.themes") ? ['atom-dark-ui', 'atom-dark-syntax']
themeNames = [themeNames] unless _.isArray(themeNames)
open: (url) ->
if url
throw new Error('opening a url does not currently work', url)
else
ipc.sendChannel('open-folder')
open: (url...) ->
ipc.sendChannel('open', [url...])
openDev: (url) ->
console.error("atom.openDev does not work yet")

View File

@@ -155,10 +155,12 @@ class AtomApplication
ipc.on 'open-config', =>
@openConfig()
ipc.on 'open-folder', =>
currentWindow = BrowserWindow.getFocusedWindow()
pathsToOpen = dialog.showOpenDialog title: 'Open', properties: ['openFile', 'openDirectory', 'multiSelections', 'createDirectory']
@open(pathToOpen) for pathToOpen in pathsToOpen if pathsToOpen?
ipc.on 'open', (processId, routingId, pathsToOpen) =>
if not pathsToOpen
pathsToOpen = dialog.showOpenDialog title: 'Open', properties: ['openFile', 'openDirectory', 'multiSelections', 'createDirectory']
@open(pathsToOpen) if pathsToOpen?
else
@open(pathsToOpen)
ipc.on 'new-window', =>
@open()