Don't add a trailing slash when adding file to projects root dir

This commit is contained in:
Corey Johnson
2012-05-01 17:25:48 -07:00
parent 17fb34ec96
commit 15d69fbc41
2 changed files with 11 additions and 1 deletions

View File

@@ -382,6 +382,15 @@ describe "TreeView", ->
expect(addDialog.miniEditor.getCursorBufferPosition().column).toBe addDialog.miniEditor.getText().length
expect(addDialog.miniEditor.isFocused).toBeTruthy()
describe "when the root directory is selected", ->
it "opens an add dialog with no path populated", ->
addDialog.cancel()
treeView.root.click()
treeView.trigger "tree-view:add"
addDialog = rootView.find(".add-dialog").view()
expect(addDialog.miniEditor.getText().length).toBe 0
describe "tree-view:move", ->
describe "when a file is selected", ->
moveDialog = null

View File

@@ -21,7 +21,8 @@ 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)
relativePath += '/' if relativePath.length > 0
@miniEditor.setText(relativePath)
confirm: ->