better at absolute pathing

This commit is contained in:
Corey Johnson
2011-10-26 14:21:20 -07:00
parent 24b39115c2
commit 1c2a4cd728

View File

@@ -9,12 +9,11 @@ module.exports =
# Make the given path absolute by resolving it against the
# current working directory.
absolute: (path) ->
if /~/.test path
OSX.NSString.stringWithString(path).stringByExpandingTildeInPath
else if path.indexOf('./') is 0
throw "absolute: ./ not yet implemented"
else
path
path = OSX.NSString.stringWithString(path).stringByStandardizingPath.toString()
return path if path[0] == "/"
resolvedString = OSX.NSString.stringWithString(@workingDirectory)
resolvedString.stringByAppendingPath(path).stringByStandardizingPath.toString()
# Return the basename of the given path. That is the path with
# any leading directory components removed. If specified, also