diff options
author | genotrance <dev@genotrance.com> | 2019-11-28 06:58:38 -0600 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-11-28 13:58:38 +0100 |
commit | 010067f3cc43f24991731d644d1abc70a07d5f38 (patch) | |
tree | 4ad96386bb6a87191282fba542a41cfd84f869da /compiler/options.nim | |
parent | abe07eb75d31189e8afea90c3c8608574f1a0751 (diff) | |
download | Nim-010067f3cc43f24991731d644d1abc70a07d5f38.tar.gz |
Substitute $nimbleDir in --path flags (#12750)
Diffstat (limited to 'compiler/options.nim')
-rw-r--r-- | compiler/options.nim | 10 |
1 files changed, 10 insertions, 0 deletions
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" |