fs.directory does not append a trailing '/' to directories

This commit is contained in:
Corey Johnson
2012-05-01 08:41:35 -07:00
parent 24ce2d362a
commit acae9d63ca
7 changed files with 24 additions and 17 deletions

View File

@@ -38,7 +38,7 @@ class Project
fs.absolute filePath
relativize: (fullPath) ->
fullPath.replace(@path, "")
fullPath.replace(@path, "").replace(/^\//, '')
bufferWithId: (id) ->
return buffer for buffer in @buffers when buffer.id == id

View File

@@ -21,7 +21,7 @@ class AddDialog extends View
@miniEditor.on 'focusout', => @remove()
directoryPath = if fs.isFile(@path) then fs.directory(@path) else @path
relativePath = @rootView.project.relativize(directoryPath)
relativePath = @rootView.project.relativize(directoryPath) + '/'
@miniEditor.setText(relativePath)
confirm: ->

View File

@@ -22,9 +22,9 @@ module.exports =
# non-directory component removed.
directory: (path) ->
if @isDirectory(path)
path.replace(/\/?$/, '/')
path.replace(/\/?$/, '')
else
path.replace(new RegExp("/#{@base(path)}$"), '/')
path.replace(new RegExp("/#{@base(path)}$"), '')
# Returns true if the file specified by path exists
exists: (path) ->