mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-24 11:37:12 +01:00
Use switch-case
This commit is contained in:
parent
687e1d6a1b
commit
fabeefdb14
@ -283,14 +283,15 @@ namespace vcpkg::Commands::Install
|
||||
{
|
||||
try
|
||||
{
|
||||
if (action.plan.plan_type == InstallPlanType::ALREADY_INSTALLED)
|
||||
switch (action.plan.plan_type)
|
||||
{
|
||||
case InstallPlanType::ALREADY_INSTALLED:
|
||||
if (std::find(specs.begin(), specs.end(), action.spec) != specs.end())
|
||||
{
|
||||
System::println(System::Color::success, "Package %s is already installed", action.spec);
|
||||
}
|
||||
}
|
||||
else if (action.plan.plan_type == InstallPlanType::BUILD_AND_INSTALL)
|
||||
break;
|
||||
case InstallPlanType::BUILD_AND_INSTALL:
|
||||
{
|
||||
const Build::BuildResult result = Commands::Build::build_package(action.plan.source_pgh.value_or_exit(VCPKG_LINE_INFO),
|
||||
action.spec,
|
||||
@ -308,15 +309,15 @@ namespace vcpkg::Commands::Install
|
||||
install_package(paths, bpgh, &status_db);
|
||||
System::println(System::Color::success, "Installing package %s... done", action.spec);
|
||||
}
|
||||
else if (action.plan.plan_type == InstallPlanType::INSTALL)
|
||||
{
|
||||
case InstallPlanType::INSTALL:
|
||||
System::println("Installing package %s... ", action.spec);
|
||||
install_package(paths, action.plan.binary_pgh.value_or_exit(VCPKG_LINE_INFO), &status_db);
|
||||
System::println(System::Color::success, "Installing package %s... done", action.spec);
|
||||
}
|
||||
else
|
||||
break;
|
||||
default:
|
||||
Checks::unreachable(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
System::println(System::Color::error, "Error: Could not install package %s: %s", action.spec, e.what());
|
||||
|
Loading…
x
Reference in New Issue
Block a user