Merge pull request #2695 from transfuturist/devel
Add path directive to allow inclusion of config file's path itself
This commit is contained in:
commit
14b2bbc24c
1 changed files with 4 additions and 2 deletions
|
|
@ -229,7 +229,8 @@ proc testCompileOption*(switch: string, info: TLineInfo): bool =
|
||||||
of "experimental": result = gExperimentalMode
|
of "experimental": result = gExperimentalMode
|
||||||
else: invalidCmdLineOption(passCmd1, switch, info)
|
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
|
let p = if notRelativeToProj or os.isAbsolute(path) or
|
||||||
'$' in path or path[0] == '.':
|
'$' in path or path[0] == '.':
|
||||||
path
|
path
|
||||||
|
|
@ -239,6 +240,7 @@ proc processPath(path: string, notRelativeToProj = false): string =
|
||||||
"nim", getPrefixDir(),
|
"nim", getPrefixDir(),
|
||||||
"lib", libpath,
|
"lib", libpath,
|
||||||
"home", removeTrailingDirSep(os.getHomeDir()),
|
"home", removeTrailingDirSep(os.getHomeDir()),
|
||||||
|
"config", cfginfo.toFullPath().splitFile().dir,
|
||||||
"projectname", options.gProjectName,
|
"projectname", options.gProjectName,
|
||||||
"projectpath", options.gProjectPath])
|
"projectpath", options.gProjectPath])
|
||||||
|
|
||||||
|
|
@ -281,7 +283,7 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
|
||||||
case switch.normalize
|
case switch.normalize
|
||||||
of "path", "p":
|
of "path", "p":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
addPath(processPath(arg), info)
|
addPath(processPath(arg, cfginfo=info), info)
|
||||||
of "nimblepath", "babelpath":
|
of "nimblepath", "babelpath":
|
||||||
# keep the old name for compat
|
# keep the old name for compat
|
||||||
if pass in {passCmd2, passPP} and not options.gNoNimblePath:
|
if pass in {passCmd2, passPP} and not options.gNoNimblePath:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue