Set compiler.options.gPrefixDir to help it find the stdlib.

Fixes #220. Fixes #173.
This commit is contained in:
Dominik Picheta 2016-06-06 21:16:08 +01:00
commit b50426c3d3
2 changed files with 6 additions and 1 deletions

View file

@ -192,6 +192,8 @@ proc findNimscriptApi(options: Options): string =
if not inPath:
raise newException(NimbleError, "Cannot find nimscriptapi.nim")
proc getNimPrefixDir(): string = splitPath(findExe("nim")).head.parentDir
proc execScript(scriptName: string, flags: StringTableRef, options: Options) =
## Executes the specified script.
##
@ -199,6 +201,9 @@ proc execScript(scriptName: string, flags: StringTableRef, options: Options) =
if "nimblepkg/nimscriptapi" notin compiler_options.implicitIncludes:
compiler_options.implicitIncludes.add("nimblepkg/nimscriptapi")
# Ensure the compiler can find its standard library #220.
compiler_options.gPrefixDir = getNimPrefixDir()
let pkgName = scriptName.splitFile.name
# Ensure that "nimblepkg/nimscriptapi" is in the PATH.