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