Don't set Buffer's file to null when the file is deleted (retain path)

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-11-28 13:40:37 -07:00
parent d6168b9954
commit d5d4751776
3 changed files with 21 additions and 13 deletions

View File

@@ -66,8 +66,8 @@ class Buffer
@reload()
@file.on "remove", =>
@file = null
@trigger "path-change", this
@updateCachedDiskContents()
@trigger "contents-change-on-disk"
@file.on "move", =>
@trigger "path-change", this
@@ -77,7 +77,10 @@ class Buffer
@setText(@cachedDiskContents)
updateCachedDiskContents: ->
@cachedDiskContents = fs.read(@getPath())
if fs.exists(@getPath())
@cachedDiskContents = fs.read(@getPath())
else
@cachedDiskContents = null
getBaseName: ->
@file?.getBaseName()