Always create new window when opening w/ no path

Fixes #5631
This commit is contained in:
Max Brunsfeld
2015-02-19 14:30:58 -08:00
parent 3911d039b4
commit 0674244f5c
2 changed files with 11 additions and 6 deletions

View File

@@ -142,3 +142,9 @@ describe "Starting Atom", ->
client
.waitForExist("atom-workspace")
.waitForPaneItemCount(1, 5000)
# Opening with no file paths always creates a new window, even if
# existing windows have no project paths.
.waitForNewWindow(->
@startAnotherAtom([], ATOM_HOME: AtomHome)
, 5000)

View File

@@ -361,12 +361,11 @@ class AtomApplication
# Default to using the specified window or the last focused window
currentWindow = window ? @lastFocusedWindow
if pathsToOpen.every((pathToOpen) -> fs.statSyncNoException(pathToOpen).isFile?())
existingWindow ?= currentWindow
unless currentWindow?.projectPaths?.length > 0
existingWindow ?= currentWindow
stats = (fs.statSyncNoException(pathToOpen) for pathToOpen in pathsToOpen)
existingWindow ?= currentWindow if (
stats.every((stat) -> stat.isFile?()) or
stats.some((stat) -> stat.isDirectory?()) and not currentWindow?.hasProjectPath()
)
if existingWindow?
openedWindow = existingWindow