-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The path string returned when nan is imported in node 6 is wrong in some cases #601
base: main
Are you sure you want to change the base?
Conversation
LGTM but it wouldn't hurt to get one or two more people to sign off on this. Can you update the commit log to explain what you changed and why? See |
Sounds like a bug in |
I speculate (but am not 100% sure) the realpath changes in v6 are responsible.
I wonder though if simply |
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] nodejs#600
bbe2ba0
to
1bf8e0e
Compare
Done!
I believe so, I've tested the method with the following results:
|
Sorry, I pressed the wrong button |
I've done some tests with the |
@rvagg I think you are the original author? Maybe you can chime in? |
Addressing this: #600
With the old method to get the current directory of 'nan' module, the path isn't got properly when the parent path is in a shared resource:
vboxsrv\vagrant\NODE_MODULES\nan
(which don't exists)with the new method the current directory is obtained correctly:
\\vboxsrv\vagrant\NODE_MODULES\nan
This change makes that packages like
bufferutil
orref
are built correctly as they are able to get thenan
headers if the working directory is inside a network resource.