Add Project.proto.relativize method to make an absolute path relative to the project root

This commit is contained in:
Nathan Sobo
2012-04-17 12:08:27 -06:00
parent a5a573d732
commit 77ec2bbb08
2 changed files with 3 additions and 1 deletions

View File

@@ -22,3 +22,5 @@ class Project
filePath = fs.join(@path, filePath) unless filePath[0] == '/'
fs.absolute filePath
relativize: (path) ->
path.replace(@path, '')

View File

@@ -115,7 +115,7 @@ class RootView extends View
@fileFinder = null
else
@project.getFilePaths().done (paths) =>
relativePaths = (path.replace(@project.path, "") for path in paths)
relativePaths = (@project.relativize(path) for path in paths)
@fileFinder = new FileFinder
paths: relativePaths
selected: (relativePath) => @open(relativePath)