Skip to content

Commit

Permalink
override the lib location via nimlib.cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Rumpf committed Nov 5, 2015
1 parent 243f9aa commit 78bcade
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nimscriptsupport.nim
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,17 @@ proc setupNimscript*(colorsScript: string): PEvalContext =
passes.gIncludeFile = includeModule
passes.gImportModule = importModule

options.libpath = os.findExe("nim").splitPath()[0] /../ "lib"
let nimlibCfg = os.getAppDir() / "nimlib.cfg"
var nimlib = ""
if fileExists(nimlibCfg):
nimlib = readFile(nimlibCfg).strip
if not fileExists(nimlib / "system.nim"): nimlib.setlen 0
if nimlib.len == 0:
nimlib = os.findExe("nim")
if nimlib.len == 0: quit "cannot find Nim's stdlib location"
nimlib = nimlib.splitPath()[0] /../ "lib"

options.libpath = nimlib
appendStr(searchPaths, options.libpath)
appendStr(searchPaths, options.libpath / "pure")

Expand Down

0 comments on commit 78bcade

Please sign in to comment.