Add model property for relative path

This commit is contained in:
Kevin Sawicki
2013-11-13 09:01:23 -08:00
parent 7dd84636ba
commit 6caed6e918

View File

@@ -22,6 +22,7 @@ class TextBuffer extends Model
text: -> new telepath.String('', replicated: false)
id: -> guid.create().toString()
filePath: null
relativePath: null
@::lazyGetter 'project', -> @grandparent
@@ -108,7 +109,7 @@ class TextBuffer extends Model
@emitModifiedStatusChanged(@isModified())
@file.on "moved", =>
@state.set('relativePath', @project.relativize(@getPath()))
@relativePath = @project.relativize(@getPath())
@emit "path-changed", this
### Public ###
@@ -154,7 +155,7 @@ class TextBuffer extends Model
@getRelativePath()
getRelativePath: ->
@state.get('relativePath')
@relativePath
# Sets the path for the file.
#
@@ -170,7 +171,7 @@ class TextBuffer extends Model
else
@file = null
@state.set('relativePath', @project.relativize(path))
@relativePath = @project.relativize(path)
@emit "path-changed", this
# Retrieves the current buffer's file extension.