Skip to content

Commit

Permalink
Use the absolute path instead of a relative path.
Browse files Browse the repository at this point in the history
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] #600
  • Loading branch information
amatas committed Sep 7, 2016
1 parent c95c447 commit 1bf8e0e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include_dirs.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(require('path').relative('.', __dirname));
console.log(require('path').resolve(__dirname));

0 comments on commit 1bf8e0e

Please sign in to comment.