Skip to content

Commit

Permalink
Fix npm#1491 Don't try to mkdir('/')
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Oct 4, 2011
1 parent 87d3689 commit b240b93
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/utils/mkdir-p.js
Expand Up @@ -27,6 +27,12 @@ function mkdir (ensure, mode, uid, gid, cb_) {

ensure = path.resolve(ensure).replace(/\/+$/, '')

// mkdir("/") should not do anything, since that always exists.
if (!ensure
|| (process.platform === "win32" && p.match(/^[a-zA-Z]:(\\|\/)?$/))) {
return cb_()
}

if (mkdirCache.hasOwnProperty(ensure)) {
return mkdirCache[ensure].push(cb_)
}
Expand Down

0 comments on commit b240b93

Please sign in to comment.