Check Nim version to determine Nimble dir.

This commit is contained in:
Dominik Picheta 2014-10-19 15:21:33 +01:00
commit e3cbc13568
3 changed files with 11 additions and 7 deletions

1
.gitignore vendored
View file

@ -5,4 +5,5 @@ nimcache/
# Absolute paths
/src/babel
/src/nimble
/tests/tester

View file

@ -185,8 +185,10 @@ proc parseCmdLine(): TOptions =
if result.action.typ == ActionNil:
writeHelp()
# Rename deprecated babel dir.
renameBabelToNimble(result)
# TODO: Remove this after a couple of versions.
if getNimrodVersion() > newVersion("0.9.6"):
# Rename deprecated babel dir.
renameBabelToNimble(result)
# Load nimbledata.json
let nimbledataFilename = result.getNimbleDir() / "nimbledata.json"
@ -418,7 +420,7 @@ proc buildFromDir(pkgInfo: TPackageInfo, paths: seq[string]) =
for bin in pkgInfo.bin:
echo("Building ", pkginfo.name, "/", bin, " using ", pkgInfo.backend,
" backend...")
doCmd(getNimBin() & " $# -d:release --noNimblePath $# \"$#\"" %
doCmd(getNimBin() & " $# -d:release --noBabelPath $# \"$#\"" %
[pkgInfo.backend, args, realDir / bin.changeFileExt("nim")])
proc saveNimbleMeta(pkgDestDir, url: string, filesInstalled: TSet[string]) =
@ -797,8 +799,6 @@ proc doAction(options: TOptions) =
assert false
when isMainModule:
# TODO: Check for .babel dir and rename everything to nimble.
when defined(release):
try:
parseCmdLine().doAction()

View file

@ -2,14 +2,17 @@
# BSD License. Look at license.txt for more info.
import parsecfg, streams, strutils, os
import tools
import tools, version
type
TConfig* = object
nimbleDir*: string
proc initConfig(): TConfig =
result.nimbleDir = getHomeDir() / ".nimble"
if getNimrodVersion() > newVersion("0.9.6"):
result.nimbleDir = getHomeDir() / ".nimble"
else:
result.nimbleDir = getHomeDir() / ".babel"
proc parseConfig*(): TConfig =
result = initConfig()