From d0acf988c2e5dbfaba86044749b71a0892557d32 Mon Sep 17 00:00:00 2001
From: Chiharu Shibata
Date: Sun, 20 Nov 2016 12:06:25 +0900
Subject: [PATCH] In win32 platform, %APPDATA%\npm\etc\ should coresspond to
/etc. ('npm config --global' refers to %APPDIR%\npm\etc\npmrc)
---
index.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/index.js b/index.js
index 6f8f113..9a1cdaf 100755
--- a/index.js
+++ b/index.js
@@ -2,8 +2,10 @@
var cc = require('./lib/utils')
var join = require('path').join
var deepExtend = require('deep-extend')
-var etc = '/etc'
var win = process.platform === "win32"
+var etc = win
+ ? join(process.env.APPDATA, 'npm', 'etc')
+ : '/etc'
var home = win
? process.env.USERPROFILE
: process.env.HOME
@@ -34,7 +36,7 @@ module.exports = function (name, defaults, argv, parse) {
}
// which files do we look at?
- if (!win)
+ if (etc)
[join(etc, name, 'config'),
join(etc, name + 'rc')].forEach(addConfigFile)
if (home)