diff options
author | Dominik Picheta <dominikpicheta@gmail.com> | 2015-11-07 15:48:14 +0000 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@gmail.com> | 2015-11-07 15:48:14 +0000 |
commit | c83e4390d863ab1f2d0ad4ab5417352f1ffd8f04 (patch) | |
tree | 236e61b72d354817b393099fa1fefcf257d0cbb2 /compiler/options.nim | |
parent | ae60f4ae760223c57403f2ac59014374b4655377 (diff) | |
download | Nim-c83e4390d863ab1f2d0ad4ab5417352f1ffd8f04.tar.gz |
Modified setDefaultLibpath to search using findExe"nim".
This is so that Nimble (and other tools) which use the compiler modules for nimscript support or other purposes can find $lib.
Diffstat (limited to 'compiler/options.nim')
-rw-r--r-- | compiler/options.nim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/options.nim b/compiler/options.nim index f63757ac0..9b587fcdb 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -203,6 +203,17 @@ proc setDefaultLibpath*() = else: libpath = joinPath(prefix, "lib") else: libpath = joinPath(prefix, "lib") + # Special rule to support other tools (nimble) which import the compiler + # modules and make use of them. + let realNimPath = # Make sure we expand the symlink + if symlinkExists(findExe("nim")): expandSymlink(findExe("nim")) + else: findExe("nim") + # Find out if $nim/../../lib/system.nim exists. + let parentNimLibPath = realNimPath.parentDir().parentDir() / "lib" + if not fileExists(libpath / "system.nim") and + fileExists(parentNimlibPath / "system.nim"): + libpath = parentNimLibPath + proc canonicalizePath*(path: string): string = when not FileSystemCaseSensitive: result = path.expandFilename.toLower else: result = path.expandFilename |