diff options
Diffstat (limited to 'lib/utils/mkdir-p.js')
-rw-r--r-- | lib/utils/mkdir-p.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/utils/mkdir-p.js b/lib/utils/mkdir-p.js index 5bf77509e..0e89eb450 100644 --- a/lib/utils/mkdir-p.js +++ b/lib/utils/mkdir-p.js @@ -5,6 +5,7 @@ var log = require("../utils/log") module.exports = mkdir function mkdir (ensure, chmod, cb) { + ensure = ensure.replace(/\/+$/, '') if (ensure.charAt(0) !== "/") ensure = path.join(process.cwd(), ensure) var dirs = ensure.split("/") , walker = [] @@ -17,7 +18,9 @@ function mkdir (ensure, chmod, cb) { if (d === undefined) return cb() walker.push(d) var dir = walker.join("/") - fs.stat(dir, function STATCB (er, s) { + // must be a real dir! + , stat = (dir === ensure) ? "lstat" : "stat" + fs[stat](dir, function STATCB (er, s) { if (er) { fs.mkdir(dir, chmod, function MKDIRCB (er, s) { if (er && er.message.indexOf("EEXIST") === 0) { |