Make fs.exists return false for null/undefined paths

This commit is contained in:
Nathan Sobo
2012-06-27 07:56:02 -06:00
parent 5b11762989
commit 2cb993760b
2 changed files with 3 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ describe "fs", ->
expect(fs.exists(require.resolve("fixtures") + "/-nope-does-not-exist")).toBe false
expect(fs.exists("")).toBe false
expect(fs.exists(null)).toBe false
expect(fs.exists(undefined)).toBe false
#expect(fs.exists(undefined)).toBe false
describe ".join(paths...)", ->
it "concatenates the given paths with the directory seperator", ->

View File

@@ -25,7 +25,8 @@ module.exports =
# Returns true if the file specified by path exists
exists: (path) ->
$native.exists path
return false unless path?
$native.exists(path)
# Returns the extension of a file. The extension of a file is the
# last dot (excluding any number of initial dots) followed by one or