Skip to content

Commit

Permalink
Path substitution for --out and --outdir (#12796)
Browse files Browse the repository at this point in the history
* Enable pathSubs for --out and --outDir
* Cleanup
  • Loading branch information
genotrance authored and Araq committed Dec 3, 2019
1 parent 9e1fd9e commit eed3288
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,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
Expand Down
4 changes: 1 addition & 3 deletions compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,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

iterator nimbleSubs*(conf: ConfigRef; p: string): string =
let pl = p.toLowerAscii
Expand Down

0 comments on commit eed3288

Please sign in to comment.