summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorgenotrance <dev@genotrance.com>2019-12-03 02:26:18 -0600
committerAndreas Rumpf <rumpf_a@web.de>2019-12-03 09:26:18 +0100
commiteed328856fd7784b9b57667a351429c26e918159 (patch)
treea569fe1fe7b5838344b313d2134db182bb5f9bbf /compiler
parent9e1fd9e46b5d85254dad4552f8581d042e476da0 (diff)
downloadNim-eed328856fd7784b9b57667a351429c26e918159.tar.gz
Path substitution for --out and --outdir (#12796)
* Enable pathSubs for --out and --outDir
* Cleanup
Diffstat (limited to 'compiler')
-rw-r--r--compiler/commands.nim6
-rw-r--r--compiler/options.nim4
2 files changed, 4 insertions, 6 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index bb9356a17..63b350521 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -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
diff --git a/compiler/options.nim b/compiler/options.nim
index 06f30ef99..c880534fd 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -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