fixes #3763
This commit is contained in:
parent
eae30d1961
commit
a9c251b8e0
1 changed files with 21 additions and 17 deletions
|
|
@ -253,20 +253,24 @@ 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,
|
proc processPath(path: string, info: TLineInfo,
|
||||||
cfginfo = unknownLineInfo()): string =
|
notRelativeToProj = false): 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
|
||||||
else:
|
else:
|
||||||
options.gProjectPath / path
|
options.gProjectPath / path
|
||||||
result = unixToNativePath(p % ["nimrod", getPrefixDir(),
|
try:
|
||||||
"nim", getPrefixDir(),
|
result = unixToNativePath(p % ["nimrod", getPrefixDir(),
|
||||||
"lib", libpath,
|
"nim", getPrefixDir(),
|
||||||
"home", removeTrailingDirSep(os.getHomeDir()),
|
"lib", libpath,
|
||||||
"config", cfginfo.toFullPath().splitFile().dir,
|
"home", removeTrailingDirSep(os.getHomeDir()),
|
||||||
"projectname", options.gProjectName,
|
"config", info.toFullPath().splitFile().dir,
|
||||||
"projectpath", options.gProjectPath])
|
"projectname", options.gProjectName,
|
||||||
|
"projectpath", options.gProjectPath])
|
||||||
|
except ValueError:
|
||||||
|
localError(info, "invalid path: " & p)
|
||||||
|
result = p
|
||||||
|
|
||||||
proc trackDirty(arg: string, info: TLineInfo) =
|
proc trackDirty(arg: string, info: TLineInfo) =
|
||||||
var a = arg.split(',')
|
var a = arg.split(',')
|
||||||
|
|
@ -307,19 +311,19 @@ 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, cfginfo=info), info)
|
addPath(processPath(arg, 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:
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
let path = processPath(arg, notRelativeToProj=true)
|
let path = processPath(arg, info, notRelativeToProj=true)
|
||||||
nimblePath(path, info)
|
nimblePath(path, info)
|
||||||
of "nonimblepath", "nobabelpath":
|
of "nonimblepath", "nobabelpath":
|
||||||
expectNoArg(switch, arg, pass, info)
|
expectNoArg(switch, arg, pass, info)
|
||||||
options.gNoNimblePath = true
|
options.gNoNimblePath = true
|
||||||
of "excludepath":
|
of "excludepath":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
let path = processPath(arg)
|
let path = processPath(arg, info)
|
||||||
lists.excludePath(options.searchPaths, path)
|
lists.excludePath(options.searchPaths, path)
|
||||||
lists.excludePath(options.lazyPaths, path)
|
lists.excludePath(options.lazyPaths, path)
|
||||||
if (len(path) > 0) and (path[len(path) - 1] == DirSep):
|
if (len(path) > 0) and (path[len(path) - 1] == DirSep):
|
||||||
|
|
@ -328,7 +332,7 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
|
||||||
lists.excludePath(options.lazyPaths, strippedPath)
|
lists.excludePath(options.lazyPaths, strippedPath)
|
||||||
of "nimcache":
|
of "nimcache":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
options.nimcacheDir = processPath(arg, true)
|
options.nimcacheDir = processPath(arg, info, true)
|
||||||
of "out", "o":
|
of "out", "o":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
options.outFile = arg
|
options.outFile = arg
|
||||||
|
|
@ -493,13 +497,13 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
|
||||||
if pass in {passCmd2, passPP}: extccomp.addLinkOption(arg)
|
if pass in {passCmd2, passPP}: extccomp.addLinkOption(arg)
|
||||||
of "cincludes":
|
of "cincludes":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
if pass in {passCmd2, passPP}: cIncludes.add arg.processPath
|
if pass in {passCmd2, passPP}: cIncludes.add arg.processPath(info)
|
||||||
of "clibdir":
|
of "clibdir":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
if pass in {passCmd2, passPP}: cLibs.add arg.processPath
|
if pass in {passCmd2, passPP}: cLibs.add arg.processPath(info)
|
||||||
of "clib":
|
of "clib":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
if pass in {passCmd2, passPP}: cLinkedLibs.add arg.processPath
|
if pass in {passCmd2, passPP}: cLinkedLibs.add arg.processPath(info)
|
||||||
of "header":
|
of "header":
|
||||||
headerFile = arg
|
headerFile = arg
|
||||||
incl(gGlobalOptions, optGenIndex)
|
incl(gGlobalOptions, optGenIndex)
|
||||||
|
|
@ -572,7 +576,7 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
|
||||||
of "colors": processOnOffSwitchG({optUseColors}, arg, pass, info)
|
of "colors": processOnOffSwitchG({optUseColors}, arg, pass, info)
|
||||||
of "lib":
|
of "lib":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
libpath = processPath(arg, notRelativeToProj=true)
|
libpath = processPath(arg, info, notRelativeToProj=true)
|
||||||
of "putenv":
|
of "putenv":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
splitSwitch(arg, key, val, pass, info)
|
splitSwitch(arg, key, val, pass, info)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue