_Partial_ backslash support in node.js argv directory munging

Doesn't do it when node is started from another drive using a drive-relative path.
E.g:
  d:
  cd nodejs
  c:
  d:node.exe d:test.js
This commit is contained in:
Bert Belder
2010-11-30 10:39:01 +01:00
parent 9be07f7fe1
commit fe804d9bc7

View File

@@ -530,14 +530,16 @@
var path = requireNative('path');
// Make process.argv[0] and process.argv[1] into full paths.
if (process.argv[0].indexOf('/') > 0) {
if ('/\\'.indexOf(process.argv[0].charAt(0)) < 0
&& process.argv[0].charAt(1) != ':') {
process.argv[0] = path.join(cwd, process.argv[0]);
}
if (process.argv[1]) {
// Load module
if (process.argv[1].charAt(0) != '/' &&
!(/^http:\/\//).exec(process.argv[1])) {
if ('/\\'.indexOf(process.argv[1].charAt(0)) < 0
&& process.argv[1].charAt(1) != ':'
&& !(/^http:\/\//).exec(process.argv[1])) {
process.argv[1] = path.join(cwd, process.argv[1]);
}
// REMOVEME: nextTick should not be necessary. This hack to get