Fixes #54.
This commit is contained in:
parent
536cf4d1cc
commit
39fcd3a89f
2 changed files with 10 additions and 1 deletions
|
|
@ -519,7 +519,11 @@ proc installFromDir(dir: string, latest: bool, options: TOptions,
|
||||||
elif defined(windows):
|
elif defined(windows):
|
||||||
let dest = binDir / cleanBin.changeFileExt("bat")
|
let dest = binDir / cleanBin.changeFileExt("bat")
|
||||||
echo("Creating stub: ", pkgDestDir / bin, " -> ", dest)
|
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:
|
else:
|
||||||
{.error: "Sorry, your platform is not supported.".}
|
{.error: "Sorry, your platform is not supported.".}
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import tools, version
|
||||||
type
|
type
|
||||||
TConfig* = object
|
TConfig* = object
|
||||||
nimbleDir*: string
|
nimbleDir*: string
|
||||||
|
chcp*: bool # Whether to change the code page in .cmd files on Win.
|
||||||
|
|
||||||
proc initConfig(): TConfig =
|
proc initConfig(): TConfig =
|
||||||
if getNimrodVersion() > newVersion("0.9.6"):
|
if getNimrodVersion() > newVersion("0.9.6"):
|
||||||
|
|
@ -14,6 +15,8 @@ proc initConfig(): TConfig =
|
||||||
else:
|
else:
|
||||||
result.nimbleDir = getHomeDir() / ".babel"
|
result.nimbleDir = getHomeDir() / ".babel"
|
||||||
|
|
||||||
|
result.chcp = true
|
||||||
|
|
||||||
proc parseConfig*(): TConfig =
|
proc parseConfig*(): TConfig =
|
||||||
result = initConfig()
|
result = initConfig()
|
||||||
var confFile = getConfigDir() / "nimble" / "nimble.ini"
|
var confFile = getConfigDir() / "nimble" / "nimble.ini"
|
||||||
|
|
@ -42,6 +45,8 @@ proc parseConfig*(): TConfig =
|
||||||
# Ensure we don't restore the deprecated nimble dir.
|
# Ensure we don't restore the deprecated nimble dir.
|
||||||
if e.value != getHomeDir() / ".babel":
|
if e.value != getHomeDir() / ".babel":
|
||||||
result.nimbleDir = e.value
|
result.nimbleDir = e.value
|
||||||
|
of "chcp":
|
||||||
|
result.chcp = parseBool(e.value)
|
||||||
else:
|
else:
|
||||||
raise newException(ENimble, "Unable to parse config file:" &
|
raise newException(ENimble, "Unable to parse config file:" &
|
||||||
" Unknown key: " & e.key)
|
" Unknown key: " & e.key)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue