Don't modify uri's with a scheme prefix in Project.resolve

This commit is contained in:
Nathan Sobo
2013-05-14 20:55:14 -06:00
parent 5aac826ec1
commit aefb84cdeb
2 changed files with 20 additions and 11 deletions

View File

@@ -111,14 +111,18 @@ class Project
ignoreRepositoryPath: (path) ->
config.get("core.hideGitIgnoredFiles") and git?.isPathIgnored(fsUtils.join(@getPath(), path))
# Given a path, this resolves it relative to the project directory.
# Given a uri, this resolves it relative to the project directory. If the path
# is already absolute or if it is prefixed with a scheme, it is returned unchanged.
#
# filePath - The {String} name of the path to convert
# uri - The {String} name of the path to convert
#
# Returns a {String}.
resolve: (filePath) ->
filePath = fsUtils.join(@getPath(), filePath) unless filePath[0] == '/'
fsUtils.absolute filePath
resolve: (uri) ->
if uri?.match(/[A-Za-z0-9+-.]+:\/\//) # leave path alone if it has a scheme
uri
else
uri = fsUtils.join(@getPath(), uri) unless uri[0] == '/'
fsUtils.absolute uri
# Given a path, this makes it relative to the project directory.
#