From 10af429fe34e0b687d33f8e6edcf80dbb7ac6893 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Fri, 19 May 2017 08:53:37 -0700 Subject: [PATCH] Changes per code review... Commit migrated from https://github.com/dotnet/core-setup/commit/4b5daa46104aa041645329d470842d3c1724a2eb --- src/installer/corehost/cli/fxr/fx_muxer.cpp | 35 +++++++++++++---------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/installer/corehost/cli/fxr/fx_muxer.cpp b/src/installer/corehost/cli/fxr/fx_muxer.cpp index 441e693..806ed91 100644 --- a/src/installer/corehost/cli/fxr/fx_muxer.cpp +++ b/src/installer/corehost/cli/fxr/fx_muxer.cpp @@ -677,7 +677,6 @@ bool fx_muxer_t::resolve_sdk_dotnet_path(const pal::string_t& own_dir, const pal hive_dir.push_back(global_dir); } - bool cli_version_specified = false; pal::string_t cli_version; pal::string_t sdk_path; pal::string_t global_cli_version; @@ -685,10 +684,6 @@ bool fx_muxer_t::resolve_sdk_dotnet_path(const pal::string_t& own_dir, const pal if (!global.empty()) { global_cli_version = resolve_cli_version(global); - if (!global_cli_version.empty()) - { - cli_version_specified = true; - } } for (pal::string_t dir : hive_dir) @@ -697,7 +692,16 @@ bool fx_muxer_t::resolve_sdk_dotnet_path(const pal::string_t& own_dir, const pal pal::string_t current_sdk_path = dir; append_path(¤t_sdk_path, _X("sdk")); - if (cli_version_specified) + if (global_cli_version.empty()) + { + bool parse_only_production = false; // false -- implies both production and prerelease. + pal::string_t new_cli_version = resolve_sdk_version(current_sdk_path, parse_only_production); + if (higher_sdk_version(new_cli_version, &cli_version, parse_only_production)) + { + sdk_path = current_sdk_path; + } + } + else { pal::string_t probing_sdk_path = current_sdk_path; append_path(&probing_sdk_path, global_cli_version.c_str()); @@ -715,17 +719,8 @@ bool fx_muxer_t::resolve_sdk_dotnet_path(const pal::string_t& own_dir, const pal trace::verbose(_X("CLI directory [%s] from global.json doesn't exist"), probing_sdk_path.c_str()); } } - else - { - bool parse_only_production = false; // false -- implies both production and prerelease. - pal::string_t new_cli_version = resolve_sdk_version(current_sdk_path, parse_only_production); - if (higher_sdk_version(new_cli_version, &cli_version, parse_only_production)) - { - sdk_path = current_sdk_path; - } - } } - + if (!cli_version.empty()) { append_path(&sdk_path, cli_version.c_str()); @@ -734,13 +729,13 @@ bool fx_muxer_t::resolve_sdk_dotnet_path(const pal::string_t& own_dir, const pal return true; } - if (cli_version_specified) + if (global_cli_version.empty()) { - trace::error(_X("The specified SDK version [%s] from global.json [%s] not found; install specified SDK version"), cli_version.c_str(), global.c_str()); + trace::verbose(_X("It was not possible to find any SDK version")); } - else + else { - trace::verbose(_X("It was not possible to find any SDK version")); + trace::error(_X("The specified SDK version [%s] from global.json [%s] not found; install specified SDK version"), cli_version.c_str(), global.c_str()); } return false; } -- 2.7.4