It seems that .cmd files do not work in Git bash when placed in the PATH.
What we need is a file with no file extension. From now on Nimble will
create both .cmd stubs and a stub with no file extension for each package
on Windows.
This commit is contained in:
Dominik Picheta 2014-12-25 23:19:45 +00:00
commit c00e8cbdc3

View file

@ -488,6 +488,10 @@ proc installFromDir(dir: string, latest: bool, options: TOptions,
for bin in pkgInfo.bin: for bin in pkgInfo.bin:
# TODO: Check that this binary belongs to the package being installed. # TODO: Check that this binary belongs to the package being installed.
when defined(windows): when defined(windows):
removeFile(binDir / bin.changeFileExt("cmd"))
removeFile(binDir / bin.changeFileExt(""))
# TODO: Remove this later.
# Remove .bat file too from previous installs.
removeFile(binDir / bin.changeFileExt("bat")) removeFile(binDir / bin.changeFileExt("bat"))
else: else:
removeFile(binDir / bin) removeFile(binDir / bin)
@ -517,13 +521,14 @@ proc installFromDir(dir: string, latest: bool, options: TOptions,
echo("Creating symlink: ", pkgDestDir / bin, " -> ", binDir / cleanBin) echo("Creating symlink: ", pkgDestDir / bin, " -> ", binDir / cleanBin)
createSymlink(pkgDestDir / bin, binDir / cleanBin) createSymlink(pkgDestDir / bin, binDir / cleanBin)
elif defined(windows): elif defined(windows):
let dest = binDir / cleanBin.changeFileExt("bat") let dest = binDir / cleanBin.changeFileExt("cmd")
echo("Creating stub: ", pkgDestDir / bin, " -> ", dest) echo("Creating stub: ", pkgDestDir / bin, " -> ", dest)
var contents = "" var contents = ""
if options.config.chcp: if options.config.chcp:
contents.add "chcp 65001\n" contents.add "chcp 65001\n"
contents.add "\"" & pkgDestDir / bin & "\" %*\n" contents.add "\"" & pkgDestDir / bin & "\" %*\n"
writeFile(dest, contents) writeFile(dest, contents)
writeFile(dest.changeFileExt(""), contents) # For Git bash.
else: else:
{.error: "Sorry, your platform is not supported.".} {.error: "Sorry, your platform is not supported.".}
else: else: