aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-02-03 18:25:43 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-02-03 18:25:43 -0800
commit5fa7aba4d21ce35b65da02243697319bd23bf2f6 (patch)
treebb4be2fb049ea7f22a2f8a8a82e847463fa8ae7f
parentac44d930696cfc190c33f88c9ffa673918166cf5 (diff)
downloadvcpkg-5fa7aba4d21ce35b65da02243697319bd23bf2f6.tar.gz
vcpkg-5fa7aba4d21ce35b65da02243697319bd23bf2f6.zip
[vcpkg remove] Fix remove --purge not applying to not-installed packages
-rw-r--r--toolsrc/src/commands_remove.cpp35
1 files changed, 19 insertions, 16 deletions
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);