mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Support opening non-existent files from the CLI
This required changing text-buffer to support having a path but not underlying file that exists yet. Now calling RootView.open() with a non-existed path will open a dirty empty editor to the path and the file will be created on first save.
This commit is contained in:
@@ -213,7 +213,7 @@ _.extend atom,
|
||||
@pendingBrowserProcessCallbacks[messageId]?[callbackIndex]?(data...)
|
||||
when 'openPath'
|
||||
path = data[0]
|
||||
rootView?.open(path) if fsUtils.isFile(path)
|
||||
rootView?.open(path)
|
||||
|
||||
setWindowState: (keyPath, value) ->
|
||||
windowState = @getWindowState()
|
||||
|
||||
@@ -37,13 +37,14 @@ class Buffer
|
||||
@lineEndings = []
|
||||
|
||||
if path
|
||||
throw "Path '#{path}' does not exist" unless fsUtils.exists(path)
|
||||
@setPath(path)
|
||||
if initialText?
|
||||
@setText(initialText)
|
||||
@updateCachedDiskContents()
|
||||
else
|
||||
else if fsUtils.exists(path)
|
||||
@reload()
|
||||
else
|
||||
@setText('')
|
||||
else
|
||||
@setText(initialText ? '')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user