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;
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)
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());
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());
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;
}