From 2135de059fa6a238db1a01bfc33a5ccab93cdd0b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 30 May 2013 21:37:14 +0800 Subject: [PATCH] Also listen to 'open-file' event in constructor. The 'open-file' may happen before application is launched. --- src/atom-application.coffee | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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'