From e02c9e535493842a26b4426ce602c60f90ace671 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 21 Feb 2018 19:57:14 -0800 Subject: [PATCH] [CI] Fix too early deletion of files --- toolsrc/src/vcpkg/build.cpp | 10 ---------- toolsrc/src/vcpkg/install.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index f6c995f2a1..c169a778e9 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -399,16 +399,6 @@ namespace vcpkg::Build } } - if (config.build_package_options.clean_packages == CleanPackages::YES) - { - auto& fs = paths.get_filesystem(); - const PackageSpec spec = PackageSpec::from_name_and_triplet(config.scf.core_paragraph->name, config.triplet) - .value_or_exit(VCPKG_LINE_INFO); - const fs::path package_dir = paths.package_dir(spec); - std::error_code ec; - fs.remove_all(package_dir, ec); - } - return result; } diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index d032f77d82..46c7c53b89 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -308,6 +308,15 @@ namespace vcpkg::Install auto bcf = std::make_unique( Paragraphs::try_load_cached_control_package(paths, action.spec).value_or_exit(VCPKG_LINE_INFO)); auto code = aux_install(display_name_with_features, *bcf); + + if (action.build_options.clean_packages == Build::CleanPackages::YES) + { + auto& fs = paths.get_filesystem(); + const fs::path package_dir = paths.package_dir(action.spec); + std::error_code ec; + fs.remove_all(package_dir, ec); + } + return {code, std::move(bcf)}; }