nimfix supports specialized '.nimfix' modules

This commit is contained in:
Araq 2014-09-08 09:18:09 +02:00
commit c53a27f0dc
4 changed files with 31 additions and 18 deletions

View file

@ -337,6 +337,16 @@ proc findFile*(f: string): string {.procvar.} =
proc findModule*(modulename, currentModule: string): string =
# returns path to module
when defined(nimfix):
# '.nimfix' modules are preferred over '.nim' modules so that specialized
# versions can be kept for 'nimfix'.
block:
let m = addFileExt(modulename, "nimfix")
let currentPath = currentModule.splitFile.dir
result = currentPath / m
if not existsFile(result):
result = findFile(m)
if existsFile(result): return result
let m = addFileExt(modulename, NimExt)
let currentPath = currentModule.splitFile.dir
result = currentPath / m