patchFile: support properly

This commit is contained in:
Andreas Rumpf
2016-07-14 10:54:31 +02:00
parent 6dddb3e68e
commit 0867c62ded

View File

@@ -16,7 +16,7 @@ import
os, times, osproc, wordrecg, strtabs
# we support 'cmpIgnoreStyle' natively for efficiency:
from strutils import cmpIgnoreStyle
from strutils import cmpIgnoreStyle, contains
proc listDirs(a: VmArgs, filter: set[PathComponent]) =
let dir = getString(a, 0)
@@ -125,8 +125,10 @@ proc setupVM*(module: PSym; scriptName: string): PEvalContext =
cbconf patchFile:
let key = a.getString(0) & "_" & a.getString(1)
var val = a.getString(2).addFileExt(NimExt)
if not isAbsolute(val):
val = vthisDir / pathSubs(val, vthisDir)
if {'$', '~'} in val:
val = pathSubs(val, vthisDir)
elif not isAbsolute(val):
val = vthisDir / val
gModuleOverrides[key] = val
proc runNimScript*(scriptName: string; freshDefines=true) =