diff options
author | Tomohiro <gpuppur@gmail.com> | 2019-01-23 23:02:26 +0900 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-01-23 15:02:26 +0100 |
commit | bad5ad6dc764e2b1505d27a61b949079040a5f3c (patch) | |
tree | 4bd27c529d6ff51c8cf75ff19c175eaa4c4808e9 /tools/vccexe/vccexe.nim | |
parent | c60bb94647871702c2c853fb40d4fb1363dc8247 (diff) | |
download | Nim-bad5ad6dc764e2b1505d27a61b949079040a5f3c.tar.gz |
Fix issue #10358 (#10383)
* Fix bug: vccexe finds oldest VCC * echo path to vcvarsall.bat as hint when failed to execute cl.exe
Diffstat (limited to 'tools/vccexe/vccexe.nim')
-rw-r--r-- | tools/vccexe/vccexe.nim | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/tools/vccexe/vccexe.nim b/tools/vccexe/vccexe.nim index f794885f2..28d9e4173 100644 --- a/tools/vccexe/vccexe.nim +++ b/tools/vccexe/vccexe.nim @@ -46,6 +46,8 @@ const sdktypeSepIdx = sdktypePrefix.len sdkversionSepIdx = sdkversionPrefix.len + vcvarsallDefaultPath = "vcvarsall.bat" + helpText = """ +-----------------------------------------------------------------+ | Microsoft C/C++ compiler wrapper for Nim | @@ -158,6 +160,10 @@ when isMainModule: vccversionValue = vccUndefined vcvarsallArg = discoverVccVcVarsAllPath() + if vcvarsallArg == "": + # Assume that default executable is in current directory or in PATH + vcvarsallArg = findExe(vcvarsallDefaultPath) + if printPathArg: var head = $vccversionValue if head.len < 1: @@ -180,9 +186,16 @@ when isMainModule: if not noCommandArg: # Run VCC command with the VCC process environment - let vccProcess = startProcess( - commandArg, - args = clArgs, - options = vccOptions - ) - quit vccProcess.waitForExit() + try: + let vccProcess = startProcess( + commandArg, + args = clArgs, + options = vccOptions + ) + quit vccProcess.waitForExit() + except: + if vcvarsallArg.len != 0: + echo "Hint: using " & vcvarsallArg + else: + echo "Hint: vcvarsall.bat was not found" + raise |