make bootstrapping more robust for people who have Nim inside /usr/bin (#13855)
This commit is contained in:
parent
87e6b88f3b
commit
2b3b24a804
1 changed files with 31 additions and 29 deletions
|
|
@ -102,9 +102,10 @@ proc staticWalkDirImpl(path: string, relative: bool): PNode =
|
|||
result.add newTree(nkTupleConstr, newIntNode(nkIntLit, k.ord),
|
||||
newStrNode(nkStrLit, f))
|
||||
|
||||
from std / compilesettings import SingleValueSetting, MultipleValueSetting
|
||||
when defined(nimHasInvariant):
|
||||
from std / compilesettings import SingleValueSetting, MultipleValueSetting
|
||||
|
||||
proc querySettingImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): string =
|
||||
proc querySettingImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): string =
|
||||
case SingleValueSetting(switch)
|
||||
of arguments: result = conf.arguments
|
||||
of outFile: result = conf.outFile.string
|
||||
|
|
@ -119,7 +120,7 @@ proc querySettingImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): string =
|
|||
of compileOptions: result = conf.compileOptions
|
||||
of ccompilerPath: result = conf.cCompilerPath
|
||||
|
||||
proc querySettingSeqImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): seq[string] =
|
||||
proc querySettingSeqImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): seq[string] =
|
||||
template copySeq(field: untyped): untyped =
|
||||
for i in field: result.add i.string
|
||||
|
||||
|
|
@ -181,6 +182,7 @@ proc registerAdditionalOps*(c: PCtx) =
|
|||
systemop getCurrentException
|
||||
registerCallback c, "stdlib.*.staticWalkDir", proc (a: VmArgs) {.nimcall.} =
|
||||
setResult(a, staticWalkDirImpl(getString(a, 0), getBool(a, 1)))
|
||||
when defined(nimHasInvariant):
|
||||
registerCallback c, "stdlib.compilesettings.querySetting", proc (a: VmArgs) {.nimcall.} =
|
||||
setResult(a, querySettingImpl(a, c.config, getInt(a, 0)))
|
||||
registerCallback c, "stdlib.compilesettings.querySettingSeq", proc (a: VmArgs) {.nimcall.} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue