From 53db461b4cfafce7737967fd8cab56fa98778e2e Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Mon, 28 Aug 2017 22:35:30 +0200 Subject: [PATCH] we can't assume a version of MSVC --- gn/find_msvc_root.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gn/find_msvc_root.py b/gn/find_msvc_root.py index aebb7a3..e795f8d 100644 --- a/gn/find_msvc_root.py +++ b/gn/find_msvc_root.py @@ -5,16 +5,20 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import subprocess +import os import sys msvc = int(sys.argv[1]) windk = sys.argv[2] -# for now, just assume -vc_version = '14.11.25503' - if msvc == 2015: print windk + '/VC' else: + # get the first version + dir = os.listdir(windk + '/VC/Tools/MSVC/')[0] + if os.path.exists(dir): + print dir + sys.exit(0) + # fallback to a version + vc_version = '14.11.25503' print windk + '/VC/Tools/MSVC/' + vc_version -- 2.7.4