summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-05-18 00:38:12 -0700
committerGitHub <noreply@github.com>2020-05-18 09:38:12 +0200
commitb11ff518faec4efe4d5b6e2151d07bf19e26eae0 (patch)
tree53bea862ddc10c17e27ba4e2bd4f06cb01dacc59 /compiler
parent69cc1ddc4d6aa55e717ef6d57401577d4825def8 (diff)
downloadNim-b11ff518faec4efe4d5b6e2151d07bf19e26eae0.tar.gz
fix #12293 findNimStdLibCompileTime should not break with nimble install compiler (#14334)
* fix #12293 findNimStdLibCompileTime should not break with nimble install compiler

* address comment to unblock PR
Diffstat (limited to 'compiler')
-rw-r--r--compiler/nimeval.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/nimeval.nim b/compiler/nimeval.nim
index 09d1eb1da..11e899cae 100644
--- a/compiler/nimeval.nim
+++ b/compiler/nimeval.nim
@@ -81,6 +81,9 @@ proc findNimStdLib*(): string =
   ## Returns "" on failure.
   try:
     let nimexe = os.findExe("nim")
+      # this can't work with choosenim shims, refs https://github.com/dom96/choosenim/issues/189
+      # it'd need `nim dump --dump.format:json . | jq -r .libpath`
+      # which we should simplify as `nim dump --key:libpath`
     if nimexe.len == 0: return ""
     result = nimexe.splitPath()[0] /../ "lib"
     if not fileExists(result / "system.nim"):
@@ -93,8 +96,8 @@ proc findNimStdLib*(): string =
 proc findNimStdLibCompileTime*(): string =
   ## Same as ``findNimStdLib`` but uses source files used at compile time,
   ## and asserts on error.
-  const sourcePath = currentSourcePath()
-  result = sourcePath.parentDir.parentDir / "lib"
+  const exe = getCurrentCompilerExe()
+  result = exe.splitFile.dir.parentDir / "lib"
   doAssert fileExists(result / "system.nim"), "result:" & result
 
 proc createInterpreter*(scriptName: string;