Return absolute paths from resolve methods

This mirrors the behavior of require.resolve for
all the resolve methods provided by fs-utils.
This commit is contained in:
Kevin Sawicki
2013-03-20 14:47:33 -07:00
parent d2b2c6fc8d
commit a55fdc7551

View File

@@ -207,7 +207,7 @@ module.exports =
if resolvedPath = @resolveExtension(candidatePath, extensions)
return resolvedPath
else
return candidatePath if @exists(candidatePath)
return @absolute(candidatePath) if @exists(candidatePath)
undefined
resolveOnLoadPath: (args...) ->
@@ -217,10 +217,10 @@ module.exports =
resolveExtension: (path, extensions) ->
for extension in extensions
if extension == ""
return path if @exists(path)
return @absolute(path) if @exists(path)
else
pathWithExtension = path + "." + extension.replace(/^\./, "")
return pathWithExtension if @exists(pathWithExtension)
return @absolute(pathWithExtension) if @exists(pathWithExtension)
undefined
isCompressedExtension: (ext) ->