Fixes #55.
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:
parent
54a0361704
commit
c00e8cbdc3
1 changed files with 6 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue