diff options
Diffstat (limited to 'toolsrc')
| -rw-r--r-- | toolsrc/src/vcpkg/commands.ciclean.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/toolsrc/src/vcpkg/commands.ciclean.cpp b/toolsrc/src/vcpkg/commands.ciclean.cpp index 9c69d1931..74b9b35ab 100644 --- a/toolsrc/src/vcpkg/commands.ciclean.cpp +++ b/toolsrc/src/vcpkg/commands.ciclean.cpp @@ -2,31 +2,39 @@ #include <vcpkg/base/checks.h>
#include <vcpkg/base/files.h>
+#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/vcpkgcmdarguments.h>
using namespace vcpkg;
-namespace vcpkg::Commands::CIClean
-{
- void perform_and_exit(const VcpkgCmdArguments&, const VcpkgPaths& paths)
+namespace {
+ void clear_directory(Files::Filesystem& fs, const fs::path& target)
{
- auto& fs = paths.get_filesystem();
- if (fs.is_directory(paths.buildtrees))
+ using vcpkg::System::print2;
+ if (fs.is_directory(target))
{
- fs.remove_all_inside(paths.buildtrees, VCPKG_LINE_INFO);
+ print2("Clearing contents of ", target.u8string(), "\n");
+ fs.remove_all_inside(target, VCPKG_LINE_INFO);
}
-
- if (fs.is_directory(paths.installed))
- {
- fs.remove_all_inside(paths.installed, VCPKG_LINE_INFO);
- }
-
- if (fs.is_directory(paths.packages))
+ else
{
- fs.remove_all_inside(paths.packages, VCPKG_LINE_INFO);
+ print2("Skipping clearing contents of ", target.u8string(), " because it was not a directory\n");
}
+ }
+}
+namespace vcpkg::Commands::CIClean
+{
+ void perform_and_exit(const VcpkgCmdArguments&, const VcpkgPaths& paths)
+ {
+ using vcpkg::System::print2;
+ auto& fs = paths.get_filesystem();
+ print2("Starting vcpkg CI clean\n");
+ clear_directory(fs, paths.buildtrees);
+ clear_directory(fs, paths.installed);
+ clear_directory(fs, paths.packages);
+ print2("Completed vcpkg CI clean\n");
Checks::exit_success(VCPKG_LINE_INFO);
}
}
|
