mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user