diff options
author | Araq <rumpf_a@web.de> | 2015-09-29 20:44:12 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-09-29 20:44:12 +0200 |
commit | 1b7d8246c13c48ba8037321a000d5688a8bdb5fe (patch) | |
tree | f20a16f306b295f2f4904617aaea355859c4beba /compiler | |
parent | 27bdf5c45c7850f62ae573fdcd86e8490a2bec15 (diff) | |
download | Nim-1b7d8246c13c48ba8037321a000d5688a8bdb5fe.tar.gz |
NimScript: setCommand takes an optional project filename
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/nim.nim | 2 | ||||
-rw-r--r-- | compiler/scriptconfig.nim | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/compiler/nim.nim b/compiler/nim.nim index 51f4cae92..64c4e2026 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -48,7 +48,7 @@ proc handleCmdLine() = gProjectFull = canonicalizePath(gProjectName) except OSError: gProjectFull = gProjectName - var p = splitFile(gProjectFull) + let p = splitFile(gProjectFull) gProjectPath = p.dir gProjectName = p.name else: diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim index 8499ebd98..aaa2486e5 100644 --- a/compiler/scriptconfig.nim +++ b/compiler/scriptconfig.nim @@ -105,6 +105,13 @@ proc setupVM*(module: PSym; scriptName: string): PEvalContext = setResult(a, strutils.cmpIgnoreCase(a.getString 0, a.getString 1)) cbconf setCommand: options.command = a.getString 0 + let arg = a.getString 1 + if arg.len > 0: + gProjectName = arg + try: + gProjectFull = canonicalizePath(gProjectPath / gProjectName) + except OSError: + gProjectFull = gProjectName cbconf getCommand: setResult(a, options.command) cbconf switch: |