]> git.pld-linux.org Git - packages/npm.git/blob - link-globalPaths.patch
Up to 1.1.68
[packages/npm.git] / link-globalPaths.patch
1 diff -ur npm-1.1.68-o/lib/link.js npm-1.1.68/lib/link.js
2 --- npm-1.1.68-o/lib/link.js    2012-08-22 11:43:26.000000000 -0600
3 +++ npm-1.1.68/lib/link.js      2012-12-02 11:51:35.000000000 -0700
4 @@ -9,6 +9,7 @@
5    , chain = require("slide").chain
6    , path = require("path")
7    , rm = require("rimraf")
8 +  , globalPaths = require('module').globalPaths
9    , build = require("./build.js")
10  
11  module.exports = link
12 @@ -78,11 +79,24 @@
13        })
14      }
15  
16 -    fs.lstat(pp, function (er, st) {
17 -      if (er) {
18 +    // find pp from globalPaths
19 +    asyncMap(globalPaths, function(f, cb) {
20 +      f = path.resolve(f, pkg)
21 +      fs.lstat(f, function(er, st) {
22 +        if (er) {
23 +          cb()
24 +        } else {
25 +          cb(null, f, st)
26 +        }
27 +      });
28 +    }, function(er, f, st) {
29 +      pp = f && f[0] || path.resolve(npm.globalDir, pkg)
30 +
31 +      if (er) return cb()
32 +      if (!f || !f[0]) {
33          rp = pp
34          return npm.commands.install(t, pkg, n)
35 -      } else if (!st.isSymbolicLink()) {
36 +      } else if (!st[0].isSymbolicLink()) {
37          rp = pp
38          next()
39        } else {
This page took 0.09581 seconds and 4 git commands to generate.