mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Add Project.proto.relativize method to make an absolute path relative to the project root
This commit is contained in:
@@ -22,3 +22,5 @@ class Project
|
||||
filePath = fs.join(@path, filePath) unless filePath[0] == '/'
|
||||
fs.absolute filePath
|
||||
|
||||
relativize: (path) ->
|
||||
path.replace(@path, '')
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user