mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Also listen to 'open-file' event in constructor.
The 'open-file' may happen before application is launched.
This commit is contained in:
@@ -24,6 +24,15 @@ class AtomApplication
|
||||
@pathsToOpen ?= []
|
||||
@windows = []
|
||||
|
||||
app.on 'open-file', (event, filePath) =>
|
||||
event.preventDefault()
|
||||
if @launched
|
||||
@openPath filePath
|
||||
else
|
||||
# Delay opening until Atom has finished launching, this condition
|
||||
# happens when user double clicks a file in Finder to open it.
|
||||
@pathsToOpen.push filePath
|
||||
|
||||
app.on 'finish-launching', =>
|
||||
@launched = true
|
||||
|
||||
@@ -146,15 +155,6 @@ class AtomApplication
|
||||
app.on 'window-all-closed', ->
|
||||
app.quit()
|
||||
|
||||
app.on 'open-file', (event, filePath) =>
|
||||
event.preventDefault()
|
||||
if @launched
|
||||
@openPath filePath
|
||||
else
|
||||
# Delay opening until Atom has finished launching, this condition
|
||||
# happens when user double clicks a file in Finder to open it.
|
||||
@pathsToOpen.push filePath
|
||||
|
||||
ipc.on 'close-without-confirm', (processId, routingId) ->
|
||||
window = BrowserWindow.fromProcessIdAndRoutingId processId, routingId
|
||||
window.removeAllListeners 'close'
|
||||
|
||||
Reference in New Issue
Block a user