From c00e8cbdc3a4d32d8dcb169dd194be7dde0afe3d Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Thu, 25 Dec 2014 23:19:45 +0000 Subject: [PATCH] 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. --- src/nimble.nim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nimble.nim b/src/nimble.nim index bd5d385..ed3a182 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -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: