Browse Source

_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
v0.7.4-release
Bert Belder 14 years ago
parent
commit
fe804d9bc7
  1. 8
      src/node.js

8
src/node.js

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

Loading…
Cancel
Save