fs.directory returns empty string if path has no parent directory

This commit is contained in:
Corey Johnson
2012-07-03 14:43:56 -07:00
parent e36b5521bd
commit 08b0a686ed
2 changed files with 6 additions and 3 deletions

View File

@@ -21,7 +21,9 @@ module.exports =
# parent directory if the file is a directory. A terminal directory
# separator is ignored.
directory: (path) ->
path.replace(new RegExp("/#{@base(path)}\/?$"), '')
parentPath = path.replace(new RegExp("/#{@base(path)}\/?$"), '')
return "" if path == parentPath
parentPath
# Returns true if the file specified by path exists
exists: (path) ->