diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-10-30 17:21:05 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-10-30 17:21:05 +0100 |
commit | 08950649839c1df1504d495fccfea04bf11f55ed (patch) | |
tree | 8d56f635aec69802506b2e8498366e05140937d2 /compiler | |
parent | a155130cf2a1ba57501f5b22e4b6818fbc2bd0ae (diff) | |
download | Nim-08950649839c1df1504d495fccfea04bf11f55ed.tar.gz |
getEnv now supports a 'default' parameter; refs #6019
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/scriptconfig.nim | 2 | ||||
-rw-r--r-- | compiler/vmops.nim | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim index 0c31eadbe..22377a1e2 100644 --- a/compiler/scriptconfig.nim +++ b/compiler/scriptconfig.nim @@ -79,7 +79,7 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string; setResult(a, osproc.execCmd getString(a, 0)) cbconf getEnv: - setResult(a, os.getEnv(a.getString 0)) + setResult(a, os.getEnv(a.getString 0, a.getString 1)) cbconf existsEnv: setResult(a, os.existsEnv(a.getString 0)) cbconf dirExists: diff --git a/compiler/vmops.nim b/compiler/vmops.nim index 38135951d..2a00f207a 100644 --- a/compiler/vmops.nim +++ b/compiler/vmops.nim @@ -47,6 +47,11 @@ template wrap1s_ospaths(op) {.dirty.} = setResult(a, op(getString(a, 0))) ospathsop op +template wrap2s_ospaths(op) {.dirty.} = + proc `op Wrapper`(a: VmArgs) {.nimcall.} = + setResult(a, op(getString(a, 0), getString(a, 1))) + ospathsop op + template wrap1s_system(op) {.dirty.} = proc `op Wrapper`(a: VmArgs) {.nimcall.} = setResult(a, op(getString(a, 0))) @@ -96,7 +101,7 @@ proc registerAdditionalOps*(c: PCtx) = wrap1f_math(ceil) wrap2f_math(fmod) - wrap1s_ospaths(getEnv) + wrap2s_ospaths(getEnv) wrap1s_ospaths(existsEnv) wrap1s_os(dirExists) wrap1s_os(fileExists) |