Put "nimblepkg/nimscriptapi.nim" under nimbleDir, fix #363 (#416)

* Put "nimblepkg/nimscriptapi.nim" under nimbleDir, fix #363

By default, the module will be under
  $HOME/.nimble/nimblecache/nimblepkg/nimscriptapi.nim
and the following directory will be in the searchPaths
  $HOME/.nimble/nimblecache/

* Put "nimblepkg/nimscriptapi.nim" under nimbleDir, fix #363

By default, the module will be under
  $HOME/.nimble/nimblecache/nimblepkg/nimscriptapi.nim
and the following directory will be in the searchPaths
  $HOME/.nimble/nimblecache/
This commit is contained in:
Xiao-Yong 2017-10-19 12:58:50 -05:00 committed by Dominik Picheta
commit 4992707e8b

View file

@ -224,11 +224,12 @@ proc execScript(scriptName: string, flags: Flags, options: Options): PSym =
let pkgName = scriptName.splitFile.name
# Ensure that "nimblepkg/nimscriptapi" is in the PATH.
# TODO: put this in a more isolated directory.
let tmpNimscriptApiPath = getTempDir() / "nimblepkg" / "nimscriptapi.nim"
createDir(tmpNimscriptApiPath.splitFile.dir)
writeFile(tmpNimscriptApiPath, nimscriptApi)
searchPaths.add(getTempDir())
block:
let t = options.getNimbleDir / "nimblecache"
let tmpNimscriptApiPath = t / "nimblepkg" / "nimscriptapi.nim"
createDir(tmpNimscriptApiPath.splitFile.dir)
writeFile(tmpNimscriptApiPath, nimscriptApi)
searchPaths.add(t)
initDefines()
loadConfigs(DefaultConfig)