Restore old behavior for multiple path CLI args

Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
Max Brunsfeld 2015-02-17 15:25:50 -08:00 committed by Nathan Sobo
parent 3c13b37a18
commit bcfa4ef608
4 changed files with 33 additions and 4 deletions

View File

@ -86,7 +86,7 @@ describe "Starting Atom", ->
.waitForPaneItemCount(1, 5000)
it "allows multiple project directories to be passed as separate arguments", ->
runAtom [tempDirPath, otherTempDirPath], {ATOM_HOME: AtomHome}, (client) ->
runAtom [tempDirPath, otherTempDirPath, "--multi-folder"], {ATOM_HOME: AtomHome}, (client) ->
client
.waitForExist("atom-workspace", 5000)
.then((exists) -> expect(exists).toBe true)
@ -100,3 +100,24 @@ describe "Starting Atom", ->
.waitForPaneItemCount(1, 5000)
.execute(-> atom.project.getPaths())
.then(({value}) -> expect(value).toEqual([tempDirPath, otherTempDirPath]))
it "opens each path in its own window unless the --multi-folder flag is passed", ->
runAtom [tempDirPath, otherTempDirPath], {ATOM_HOME: AtomHome}, (client) ->
projectPaths = []
client
.waitForWindowCount(2, 5000)
.windowHandles()
.then ({value: windowHandles}) ->
@window(windowHandles[0])
.execute(-> atom.project.getPaths())
.then ({value}) ->
expect(value).toHaveLength(1)
projectPaths.push(value[0])
.window(windowHandles[1])
.execute(-> atom.project.getPaths())
.then ({value}) ->
expect(value).toHaveLength(1)
projectPaths.push(value[0])
.then ->
expect(projectPaths.sort()).toEqual([tempDirPath, otherTempDirPath].sort())

View File

@ -82,11 +82,15 @@ class AtomApplication
@openWithOptions(options)
# Opens a new window based on the options provided.
openWithOptions: ({pathsToOpen, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile}) ->
openWithOptions: ({pathsToOpen, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile, enableMultiFolderProject}) ->
if test
@runSpecs({exitWhenDone: true, @resourcePath, specDirectory, logFile})
else if pathsToOpen.length > 0
@openPaths({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode})
if enableMultiFolderProject
@openPaths({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode})
else
for pathToOpen in pathsToOpen
@openPath({pathToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode})
else if urlsToOpen.length > 0
@openUrl({urlToOpen, devMode, safeMode}) for urlToOpen in urlsToOpen
else

View File

@ -58,6 +58,7 @@ class AtomWindow
else
pathToOpen
loadSettings.initialPaths.sort()
@projectPaths = loadSettings.initialPaths
@browserWindow.loadSettings = loadSettings
@browserWindow.once 'window:loaded', =>

View File

@ -118,6 +118,7 @@ parseCommandLine = ->
options.alias('v', 'version').boolean('v').describe('v', 'Print the version.')
options.alias('w', 'wait').boolean('w').describe('w', 'Wait for window to be closed before returning.')
options.string('socket-path')
options.boolean('multi-folder')
args = options.argv
if args.help
@ -139,6 +140,7 @@ parseCommandLine = ->
pidToKillWhenClosed = args['pid'] if args['wait']
logFile = args['log-file']
socketPath = args['socket-path']
enableMultiFolderProject = args['multi-folder']
if args['resource-path']
devMode = true
@ -163,6 +165,7 @@ parseCommandLine = ->
# explicitly pass it by command line, see http://git.io/YC8_Ew.
process.env.PATH = args['path-environment'] if args['path-environment']
{resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile, socketPath}
{resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed,
devMode, safeMode, newWindow, specDirectory, logFile, socketPath, enableMultiFolderProject}
start()