diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2015-05-26 21:13:52 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2015-05-26 21:13:52 +0200 |
commit | 14b2bbc24c3fa6d2dfd982438508a3de5082abed (patch) | |
tree | 1ffd68fa2bec831051e323dbfe701793f98d133a | |
parent | 3db13ba0e0472da940b6c4632acd6f4e65e7a825 (diff) | |
parent | 8fc53f29520dd9a5eee86393dad63bd3f16aa54b (diff) | |
download | Nim-14b2bbc24c3fa6d2dfd982438508a3de5082abed.tar.gz |
Merge pull request #2695 from transfuturist/devel
Add path directive to allow inclusion of config file's path itself
-rw-r--r-- | compiler/commands.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim index b6ebb6bcb..d30d8326c 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -229,7 +229,8 @@ proc testCompileOption*(switch: string, info: TLineInfo): bool = of "experimental": result = gExperimentalMode else: invalidCmdLineOption(passCmd1, switch, info) -proc processPath(path: string, notRelativeToProj = false): string = +proc processPath(path: string, notRelativeToProj = false, + cfginfo = unknownLineInfo()): string = let p = if notRelativeToProj or os.isAbsolute(path) or '$' in path or path[0] == '.': path @@ -239,6 +240,7 @@ proc processPath(path: string, notRelativeToProj = false): string = "nim", getPrefixDir(), "lib", libpath, "home", removeTrailingDirSep(os.getHomeDir()), + "config", cfginfo.toFullPath().splitFile().dir, "projectname", options.gProjectName, "projectpath", options.gProjectPath]) @@ -281,7 +283,7 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = case switch.normalize of "path", "p": expectArg(switch, arg, pass, info) - addPath(processPath(arg), info) + addPath(processPath(arg, cfginfo=info), info) of "nimblepath", "babelpath": # keep the old name for compat if pass in {passCmd2, passPP} and not options.gNoNimblePath: |