From 5fa7aba4d21ce35b65da02243697319bd23bf2f6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 3 Feb 2017 18:25:43 -0800 Subject: [vcpkg remove] Fix remove --purge not applying to not-installed packages --- toolsrc/src/commands_remove.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'toolsrc/src/commands_remove.cpp') diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index 7e8608e72..f49104d1e 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -196,26 +196,29 @@ namespace vcpkg::Commands::Remove for (const package_spec_with_remove_plan& action : remove_plan) { - if (action.plan.plan_type == remove_plan_type::NOT_INSTALLED) + const std::string display_name = action.spec.display_name(); + + switch (action.plan.plan_type) { - System::println(System::color::success, "Package %s is not installed", action.spec); + case remove_plan_type::NOT_INSTALLED: + System::println(System::color::success, "Package %s is not installed", display_name); + break; + case remove_plan_type::REMOVE: + System::println("Removing package %s... ", display_name); + remove_package(paths, action.spec, &status_db); + System::println(System::color::success, "Removing package %s... done", display_name); + break; + case remove_plan_type::UNKNOWN: + default: + Checks::unreachable(); } - else if (action.plan.plan_type == remove_plan_type::REMOVE) - { - const std::string display_name = action.spec.display_name(); - System::println("Removing package %s... ", display_name); - remove_package(paths, action.spec, &status_db); - System::println(System::color::success, "Removing package %s... done", display_name); - if (alsoRemoveFolderFromPackages) - { - System::println("Purging package %s... ", display_name); - delete_directory(paths.packages / action.spec.dir()); - System::println(System::color::success, "Purging package %s... done", display_name); - } + if (alsoRemoveFolderFromPackages) + { + System::println("Purging package %s... ", display_name); + delete_directory(paths.packages / action.spec.dir()); + System::println(System::color::success, "Purging package %s... done", display_name); } - else - Checks::unreachable(); } exit(EXIT_SUCCESS); -- cgit v1.2.3