From bcee3d1a11b3cfdb3e2cf970674b10829b9cf293 Mon Sep 17 00:00:00 2001
From: Mateusz Mikula <mati865@gmail.com>
Date: Sat, 24 Jun 2017 13:59:32 +0200
Subject: [PATCH 13/23] Revert to FHS installation paths on Windows (tests not
 fixed)

 Author:    Mateusz Mikula <mati865@gmail.com>
---
 deps/npm/bin/npm                         | 4 ++--
 deps/npm/bin/npm.cmd                     | 4 ++--
 deps/npm/lib/config/defaults.js          | 7 ++-----
 deps/npm/lib/npm.js                      | 6 ++----
 deps/npm/lib/unbuild.js                  | 1 -
 deps/npm/node_modules/bin-links/index.js | 2 +-
 6 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/deps/npm/bin/npm b/deps/npm/bin/npm
index 5acd6fb6..dc01687e 100755
--- a/deps/npm/bin/npm
+++ b/deps/npm/bin/npm
@@ -12,12 +12,12 @@ if ! [ -x "$NODE_EXE" ]; then
   NODE_EXE=node
 fi
 
-NPM_CLI_JS="$basedir/node_modules/npm/bin/npm-cli.js"
+NPM_CLI_JS="$basedir/../lib/node_modules/npm/bin/npm-cli.js"
 
 case `uname` in
   *MINGW*)
     NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
-    NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js"
+    NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/../lib/node_modules/npm/bin/npm-cli.js"
     if [ -f "$NPM_PREFIX_NPM_CLI_JS" ]; then
       NPM_CLI_JS="$NPM_PREFIX_NPM_CLI_JS"
     fi
diff --git a/deps/npm/bin/npm.cmd b/deps/npm/bin/npm.cmd
index 880554dc..12507ba1 100644
--- a/deps/npm/bin/npm.cmd
+++ b/deps/npm/bin/npm.cmd
@@ -8,9 +8,9 @@ IF NOT EXIST "%NODE_EXE%" (
   SET "NODE_EXE=node"
 )
 
-SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
+SET "NPM_CLI_JS=%~dp0\..\lib\node_modules\npm\bin\npm-cli.js"
 FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') DO (
-  SET "NPM_PREFIX_NPM_CLI_JS=%%F\node_modules\npm\bin\npm-cli.js"
+  SET "NPM_PREFIX_NPM_CLI_JS=%%F\..\lib\node_modules\npm\bin\npm-cli.js"
 )
 IF EXIST "%NPM_PREFIX_NPM_CLI_JS%" (
   SET "NPM_CLI_JS=%NPM_PREFIX_NPM_CLI_JS%"
diff --git a/deps/npm/lib/config/defaults.js b/deps/npm/lib/config/defaults.js
index c049f213..d1654b7c 100644
--- a/deps/npm/lib/config/defaults.js
+++ b/deps/npm/lib/config/defaults.js
@@ -81,8 +81,8 @@ var uidOrPid = process.getuid ? process.getuid() : process.pid
 if (home) process.env.HOME = home
 else home = path.resolve(temp, 'npm-' + uidOrPid)
 
-var cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm'
-var cacheRoot = (process.platform === 'win32' && process.env.APPDATA) || home
+var cacheExtra = '.npm'
+var cacheRoot = home
 var cache = path.resolve(cacheRoot, cacheExtra)
 
 var globalPrefix
@@ -91,9 +91,6 @@ Object.defineProperty(exports, 'defaults', {get: function () {
 
   if (process.env.PREFIX) {
     globalPrefix = process.env.PREFIX
-  } else if (process.platform === 'win32') {
-    // c:\node\node.exe --> prefix=c:\node\
-    globalPrefix = path.dirname(process.execPath)
   } else {
     // /usr/local/bin/node --> prefix=/usr/local
     globalPrefix = path.dirname(path.dirname(process.execPath))
diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js
index e5871260..ad9ed251 100644
--- a/deps/npm/lib/npm.js
+++ b/deps/npm/lib/npm.js
@@ -387,7 +387,7 @@
     {
       get: function () {
         var b = npm.globalPrefix
-        if (process.platform !== 'win32') b = path.resolve(b, 'bin')
+        b = path.resolve(b, 'bin')
         return b
       }
     })
@@ -404,9 +404,7 @@
   Object.defineProperty(npm, 'globalDir',
     {
       get: function () {
-        return (process.platform !== 'win32')
-          ? path.resolve(npm.globalPrefix, 'lib', 'node_modules')
-          : path.resolve(npm.globalPrefix, 'node_modules')
+        return path.resolve(npm.globalPrefix, 'lib', 'node_modules')
       },
       enumerable: true
     })
diff --git a/deps/npm/lib/unbuild.js b/deps/npm/lib/unbuild.js
index 78293c9c..0360b8c6 100644
--- a/deps/npm/lib/unbuild.js
+++ b/deps/npm/lib/unbuild.js
@@ -92,7 +92,6 @@ function rmBins (pkg, folder, parent, top, cb) {
 function rmMans (pkg, folder, parent, top, cb) {
   if (!pkg.man ||
       !top ||
-      process.platform === 'win32' ||
       !npm.config.get('global')) {
     return cb()
   }
diff --git a/deps/npm/node_modules/bin-links/index.js b/deps/npm/node_modules/bin-links/index.js
index e6370aca..759daee6 100644
--- a/deps/npm/node_modules/bin-links/index.js
+++ b/deps/npm/node_modules/bin-links/index.js
@@ -115,7 +115,7 @@ function linkBin (from, to, opts, cb) {
 }
 
 function linkMans (pkg, folder, parent, gtop, opts) {
-  if (!pkg.man || !gtop || process.platform === 'win32') return
+  if (!pkg.man || !gtop) return
 
   var manRoot = path.resolve(opts.prefix, 'share', 'man')
   opts.log.verbose('linkMans', 'man files are', pkg.man, 'in', manRoot)
-- 
2.17.0.windows.1
