Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-08-27 10:12:26 +0400
committerisaacs <i@izs.me>2010-08-27 10:12:26 +0400
commit83f68e44a0bbadafd58c6a3fdf294a877b708085 (patch)
tree70dae64b0379f26cdf887d39f88877edeedb00d3 /lib
parent9b3e58228920bdb661d07061fd45a40961547650 (diff)
Don't overwrite actual real live code in lib dirs if they were linked with older versions of npm.v0.1.27-4
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/mkdir-p.js5
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) {