From 1bf8e0ef50922b782eed1d2e351085bd017f783b Mon Sep 17 00:00:00 2001 From: Alfredo Matas Date: Wed, 10 Aug 2016 12:48:15 +0200 Subject: [PATCH] Use the absolute path instead of a relative path. The latest implementation of the path.relative function of node v6 seems to be broken when either of the "from" or "to" paths are in a network resource of windows, removing the leading backslashes "\\" and returning a wrong path [0]. The new approach employs the path.resolve function that returns the absolute path to the nan headers and seems to work fine in the case of node v6 running in a windows box. Tests: * Windows 10 with node 4.3.0: c:\>node -e "console.log(require('path').relative('.','\\\\VBOXSRV\\vagrant'))" returns: \\VBOXSRV\vagrant\ * Windows 10 with node 6.5.0: c:\>node -e "console.log(require('path').relative('.','\\\\VBOXSRV\\vagrant'))" returns: VBOXSRV\vagrant\ [0] https://github.com/nodejs/nan/issues/600 --- include_dirs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include_dirs.js b/include_dirs.js index 4f1dfb41..f56b6554 100644 --- a/include_dirs.js +++ b/include_dirs.js @@ -1 +1 @@ -console.log(require('path').relative('.', __dirname)); +console.log(require('path').resolve(__dirname));