Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #12293 findNimStdLibCompileTime should not break with nimble install compiler #14334

Merged
merged 2 commits into from
May 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions compiler/nimeval.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand All @@ -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;
Expand Down