diff --git a/src/app/window.coffee b/src/app/window.coffee index 9f19b9f51..f4e990524 100644 --- a/src/app/window.coffee +++ b/src/app/window.coffee @@ -121,11 +121,6 @@ window.deserializeEditorWindow = -> window.project = new Project(pathToOpen) window.rootView = deserialize(windowState.rootView) ? new RootView - if !pathToOpen - rootView.open(pathToOpen) - else if !windowState.rootView and fsUtils.isFile(pathToOpen) - rootView.open(pathToOpen) - $(rootViewParentSelector).append(rootView) window.git = Git.open(project.getPath()) diff --git a/src/atom-window.coffee b/src/atom-window.coffee index 22d0422c2..2eb984723 100644 --- a/src/atom-window.coffee +++ b/src/atom-window.coffee @@ -14,6 +14,7 @@ class AtomWindow @handleEvents() @browserWindow.loadSettings = {pathToOpen, bootstrapScript, resourcePath, exitWhenDone} + @browserWindow.once 'window:loaded', => @loaded = true @browserWindow.loadUrl "file://#{resourcePath}/static/index.html" getPathToOpen: -> @@ -63,8 +64,11 @@ class AtomWindow @sendCommand 'window:close' openPath: (pathToOpen) -> - @focus() - @sendCommand('window:open-path', pathToOpen) + if @loaded + @focus() + @sendCommand('window:open-path', pathToOpen) + else + @browserWindow.once 'window:loaded', => @openPath(pathToOpen) sendCommand: (command, args...) -> ipc.sendChannel @browserWindow.getProcessId(), @browserWindow.getRoutingId(), 'command', command, args... diff --git a/static/index.html b/static/index.html index 7e65f1b02..acdb82474 100644 --- a/static/index.html +++ b/static/index.html @@ -10,6 +10,7 @@ require('coffee-script'); require('coffee-cache').setCacheDir('/tmp/atom-coffee-cache'); require(currentWindow.loadSettings.bootstrapScript); + currentWindow.emit('window:loaded') } catch (error) { currentWindow.openDevTools();