From 1ed6733ab5ebb941363791cd6ade88d0366563d1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 7 Oct 2013 17:09:52 -0700 Subject: [PATCH] Only parse line number when path to open is set Previously if atom was launched with no path to open then '/' was being opened as the project and a file named 'undefined' was initially open. This was because path.basename() returns the string 'undefined' when called with an undefined path. This restores the previous behavior of launching a new untitled editor with no project. Closes #936 --- src/atom-application.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/atom-application.coffee b/src/atom-application.coffee index 2d3bb244f..f094dac4e 100644 --- a/src/atom-application.coffee +++ b/src/atom-application.coffee @@ -221,9 +221,10 @@ class AtomApplication # + devMode: # Boolean to control the opened window's dev mode. openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode}={}) -> - [basename, initialLine] = path.basename(pathToOpen).split(':') - pathToOpen = "#{path.dirname(pathToOpen)}/#{basename}" - initialLine -= 1 if initialLine # Convert line numbers to a base of 0 + if pathToOpen + [basename, initialLine] = path.basename(pathToOpen).split(':') + pathToOpen = "#{path.dirname(pathToOpen)}/#{basename}" + initialLine -= 1 if initialLine # Convert line numbers to a base of 0 unless devMode existingWindow = @windowForPath(pathToOpen) unless pidToKillWhenClosed or newWindow