diff options
author | isaacs <i@izs.me> | 2011-10-22 12:01:57 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-10-22 12:01:57 +0400 |
commit | 5b287dc6e3bfff6c3cd06cc86d0de380b678a351 (patch) | |
tree | 395bddb30f2c795ee4f849fe8d894b70015be412 /lib | |
parent | 2e457459673f24aba25451b858a47cd22e873c7f (diff) |
Close #1581 windows cmd: Look in local folder for interpreter
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils/cmd-shim.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/utils/cmd-shim.js b/lib/utils/cmd-shim.js index 1bd483329..802fdb8fc 100644 --- a/lib/utils/cmd-shim.js +++ b/lib/utils/cmd-shim.js @@ -60,15 +60,35 @@ function writeShim (from, to, cb) { function writeShim_ (from, to, prog, args, cb) { var target = relativize(from, to).split("/").join("\\") + , longProg args = args || "" if (!prog) { prog = "\"%~dp0\\" + target + "\"" args = "" target = "" } else { + longProg = "\"%~dp0\"\\\"" + prog + ".exe\"" target = "\"%~dp0\\" + target + "\"" } - var cmd = "@" + prog + " " + args + " " + target + " %*\r\n" + + // @IF EXIST "%~dp0"\"node.exe" ( + // "%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* + // ) ELSE ( + // node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* + // ) + var cmd + if (longProg) { + cmd = "@IF EXIST " + longProg + " (\r\n" + + " " + longProg + " " + args + " " + target + " %*\r\n" + + ") ELSE (\r\n" + + " " + prog + " " + args + " " + target + " %*\r\n" + + ")" + } else { + cmd = prog + " " + args + " " + target + " %*\r\n" + } + + cmd = ":: Created by npm, please don't edit manually.\r\n" + cmd + fs.writeFile(to + ".cmd", cmd, "utf8", function (er) { if (er) { log.warn("Could not write "+to+".cmd", "cmdShim") |