diff --git a/src/atom-application.coffee b/src/atom-application.coffee index 3698d53ad..b1e32d224 100644 --- a/src/atom-application.coffee +++ b/src/atom-application.coffee @@ -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'