From: Mikko Rasa Date: Sun, 18 Dec 2022 11:03:50 +0000 (+0200) Subject: Detect the latest MSVC tools version X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c2f57c48045b24fc63b50863bcbec978ba7e45b5;p=builder.git Detect the latest MSVC tools version --- diff --git a/source/microsofttools.cpp b/source/microsofttools.cpp index 05edda5..9d3f1da 100644 --- a/source/microsofttools.cpp +++ b/source/microsofttools.cpp @@ -42,7 +42,17 @@ void MicrosoftTools::find_vc_bin_dir(Builder &builder, const Architecture &arch) builder.get_logger().log("tools", format("Visual Studio found in %s", vs_path)); - FS::Path vc_version_fn = vs_path/"VC"/"Auxiliary"/"Build"/"Microsoft.VCToolsVersion.v142.default.txt"; + FS::Path vc_aux_build_dir = vs_path/"VC"/"Auxiliary"/"Build"; + builder.get_logger().log("files", format("Traversing %s", vc_aux_build_dir)); + vector vc_version_files = FS::list_filtered(vc_aux_build_dir, "^Microsoft\\.VCToolsVersion\\."); + if(vc_version_files.empty()) + { + builder.get_logger().log("problems", "MSVC tools version not found"); + return; + } + + sort(vc_version_files); + FS::Path vc_version_fn = vc_aux_build_dir/vc_version_files.back(); builder.get_logger().log("files", format("Reading %s", vc_version_fn)); char buffer[256]; unsigned len = IO::File(vc_version_fn.str()).read(buffer, sizeof(buffer));