diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-03-10 16:31:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-11 00:31:34 +0100 |
commit | e64f1c7ee4a25a1df837617f4a79ce7e515b9e0d (patch) | |
tree | acac38f8164d30f10f4ef6efc3d4bba87c180efa /tools/kochdocs.nim | |
parent | 3b7b01779856f50de94467fef9409ce228aa1ff1 (diff) | |
download | Nim-e64f1c7ee4a25a1df837617f4a79ce7e515b9e0d.tar.gz |
`koch --nim:pathto/nim boot` and `koch boot --hint:cc:off` now work (#13516)
* `koch boot --hint:cc:off` now works * `koch --nim:pathto/nim boot` now works; code cleanup
Diffstat (limited to 'tools/kochdocs.nim')
-rw-r--r-- | tools/kochdocs.nim | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/kochdocs.nim b/tools/kochdocs.nim index a5166973a..75df629e3 100644 --- a/tools/kochdocs.nim +++ b/tools/kochdocs.nim @@ -18,15 +18,19 @@ proc exe*(f: string): string = when defined(windows): result = result.replace('/','\\') -proc findNim*(): string = - if nimExe.len > 0: return nimExe - var nim = "nim".exe - result = "bin" / nim - if existsFile(result): return +proc findNimImpl*(): tuple[path: string, ok: bool] = + if nimExe.len > 0: return (nimExe, true) + let nim = "nim".exe + result.path = "bin" / nim + result.ok = true + if existsFile(result.path): return for dir in split(getEnv("PATH"), PathSep): - if existsFile(dir / nim): return dir / nim + result.path = dir / nim + if existsFile(result.path): return # assume there is a symlink to the exe or something: - return nim + return (nim, false) + +proc findNim*(): string = findNimImpl().path proc exec*(cmd: string, errorcode: int = QuitFailure, additionalPath = "") = let prevPath = getEnv("PATH") |