diff --git a/nimble.nimble b/nimble.nimble index 1b51ec7..84832eb 100644 --- a/nimble.nimble +++ b/nimble.nimble @@ -10,7 +10,7 @@ srcDir = "src" # Dependencies -requires "nim >= 0.13.0" +requires "nim >= 0.13.0", "compiler#head" task tests, "Run the Nimble tester!": withDir "tests": diff --git a/src/nimblepkg/nimscriptsupport.nim b/src/nimblepkg/nimscriptsupport.nim index 267c4d3..c528c8b 100644 --- a/src/nimblepkg/nimscriptsupport.nim +++ b/src/nimblepkg/nimscriptsupport.nim @@ -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.