This commit is contained in:
Dominik Picheta 2014-12-25 21:54:16 +00:00
commit 39fcd3a89f
2 changed files with 10 additions and 1 deletions

View file

@ -519,7 +519,11 @@ proc installFromDir(dir: string, latest: bool, options: TOptions,
elif defined(windows):
let dest = binDir / cleanBin.changeFileExt("bat")
echo("Creating stub: ", pkgDestDir / bin, " -> ", dest)
writeFile(dest, "\"" & pkgDestDir / bin & "\" %*\n")
var contents = ""
if options.config.chcp:
contents.add "chcp 65001\n"
contents.add "\"" & pkgDestDir / bin & "\" %*\n"
writeFile(dest, contents)
else:
{.error: "Sorry, your platform is not supported.".}
else:

View file

@ -7,6 +7,7 @@ import tools, version
type
TConfig* = object
nimbleDir*: string
chcp*: bool # Whether to change the code page in .cmd files on Win.
proc initConfig(): TConfig =
if getNimrodVersion() > newVersion("0.9.6"):
@ -14,6 +15,8 @@ proc initConfig(): TConfig =
else:
result.nimbleDir = getHomeDir() / ".babel"
result.chcp = true
proc parseConfig*(): TConfig =
result = initConfig()
var confFile = getConfigDir() / "nimble" / "nimble.ini"
@ -42,6 +45,8 @@ proc parseConfig*(): TConfig =
# Ensure we don't restore the deprecated nimble dir.
if e.value != getHomeDir() / ".babel":
result.nimbleDir = e.value
of "chcp":
result.chcp = parseBool(e.value)
else:
raise newException(ENimble, "Unable to parse config file:" &
" Unknown key: " & e.key)