Path substitution for --out and --outdir (#12796)

* Enable pathSubs for --out and --outDir
* Cleanup

(cherry picked from commit eed328856f)
This commit is contained in:
genotrance
2019-12-03 02:26:18 -06:00
committed by narimiran
parent 4c120c1978
commit 89b244a2f5
2 changed files with 4 additions and 6 deletions

View File

@@ -390,15 +390,15 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
conf.lazyPaths.keepItIf(it != path)
of "nimcache":
expectArg(conf, switch, arg, pass, info)
conf.nimcacheDir = processPath(conf, arg, info, true)
conf.nimcacheDir = processPath(conf, arg, info, notRelativeToProj=true)
of "out", "o":
expectArg(conf, switch, arg, pass, info)
let f = splitFile(arg.expandTilde)
let f = splitFile(processPath(conf, arg, info, notRelativeToProj=true).string)
conf.outFile = RelativeFile f.name & f.ext
conf.outDir = toAbsoluteDir f.dir
of "outdir":
expectArg(conf, switch, arg, pass, info)
conf.outDir = toAbsoluteDir arg.expandTilde
conf.outDir = processPath(conf, arg, info, notRelativeToProj=true)
of "docseesrcurl":
expectArg(conf, switch, arg, pass, info)
conf.docSeeSrcUrl = arg

View File

@@ -579,9 +579,7 @@ proc pathSubs*(conf: ConfigRef; p, config: string): string =
"projectname", conf.projectName,
"projectpath", conf.projectPath.string,
"projectdir", conf.projectPath.string,
"nimcache", getNimcacheDir(conf).string])
if "~/" in result:
result = result.replace("~/", home & '/')
"nimcache", getNimcacheDir(conf).string]).expandTilde
proc toGeneratedFile*(conf: ConfigRef; path: AbsoluteFile,
ext: string): AbsoluteFile =