From 4992707e8b2486a886c99425bc9844d6dbc7b957 Mon Sep 17 00:00:00 2001 From: Xiao-Yong Date: Thu, 19 Oct 2017 12:58:50 -0500 Subject: [PATCH] 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/ --- src/nimblepkg/nimscriptsupport.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nimblepkg/nimscriptsupport.nim b/src/nimblepkg/nimscriptsupport.nim index 7188479..c186458 100644 --- a/src/nimblepkg/nimscriptsupport.nim +++ b/src/nimblepkg/nimscriptsupport.nim @@ -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)