From 010067f3cc43f24991731d644d1abc70a07d5f38 Mon Sep 17 00:00:00 2001 From: genotrance Date: Thu, 28 Nov 2019 06:58:38 -0600 Subject: Substitute $nimbleDir in --path flags (#12750) --- compiler/options.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'compiler/options.nim') diff --git a/compiler/options.nim b/compiler/options.nim index 8cfd2f2fb..f096f22e0 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -234,6 +234,7 @@ type ## symbols are always guaranteed to be style ## insensitive. Otherwise hell would break lose. packageCache*: StringTableRef + nimblePaths*: seq[AbsoluteDir] searchPaths*: seq[AbsoluteDir] lazyPaths*: seq[AbsoluteDir] outFile*: RelativeFile @@ -587,6 +588,15 @@ proc pathSubs*(conf: ConfigRef; p, config: string): string = if "~/" in result: result = result.replace("~/", home & '/') +iterator nimbleSubs*(conf: ConfigRef; p: string): string = + let pl = p.toLowerAscii + if "$nimblepath" in pl or "$nimbledir" in pl: + for i in countdown(conf.nimblePaths.len-1, 0): + let nimblePath = removeTrailingDirSep(conf.nimblePaths[i].string) + yield p % ["nimblepath", nimblePath, "nimbledir", nimblePath] + else: + yield p + proc toGeneratedFile*(conf: ConfigRef; path: AbsoluteFile, ext: string): AbsoluteFile = ## converts "/home/a/mymodule.nim", "rod" to "/home/a/nimcache/mymodule.rod" -- cgit 1.4.1-2-gfad0