From e4e648b3263106de6ac5e8c1b6c72aabe36add77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20S=2E=20Ga=C3=9Fmann?= Date: Wed, 8 May 2019 16:57:41 +0200 Subject: [PATCH] Fix visual c++ detection via vswhere --- lib/es6/vsDetect.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/es6/vsDetect.js b/lib/es6/vsDetect.js index 96d6fe70..428f0e47 100644 --- a/lib/es6/vsDetect.js +++ b/lib/es6/vsDetect.js @@ -15,18 +15,16 @@ let vsDetect = { return vsInstalled || vsvNextInstalled || buildToolsInstalled || foundByVSWhere; }), _isFoundByVSWhere: async(function* (version) { - // TODO: with auto download - /* let mainVer = version.split(".")[0]; - let command = path.resolve("vswhere.exe"); + let basePath = _.get(process.env, "ProgramFiles(x86)", _.get(process.env, "ProgramFiles")); + let command = path.resolve(basePath, "Microsoft Visual Studio", "Installer", "vswhere.exe"); try { - let stdout = yield processHelpers.exec(command, ["-version", version]); + let stdout = yield processHelpers.exec(`"${command}" -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`); return stdout && stdout.indexOf("installationVersion: " + mainVer) > 0; } catch (e) { _.noop(e); } - */ return false; }), _isBuildToolsInstalled: async(function*(version) {