diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-18 14:49:50 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-18 14:49:50 -0700 |
| commit | 5a4e7ff1b67ea2139d996af5f0f22f2efac0f27d (patch) | |
| tree | 7ae1883b734c3afadae75c197caef3154c856119 /toolsrc/src | |
| parent | 11d6aa60b27ec4e444f945ca32ce2c91a31215c0 (diff) | |
| download | vcpkg-5a4e7ff1b67ea2139d996af5f0f22f2efac0f27d.tar.gz vcpkg-5a4e7ff1b67ea2139d996af5f0f22f2efac0f27d.zip | |
Workaround for fs::remove_all()
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg_Files.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp index d0e55a215..599c6f5ef 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg_Files.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include "vcpkg_Files.h" #include "vcpkg_System.h" +#include <thread> namespace vcpkg::Files { @@ -115,7 +116,22 @@ namespace vcpkg::Files } virtual std::uintmax_t remove_all(const fs::path & path, std::error_code& ec) override { - return fs::stdfs::remove_all(path, ec); + // Working around the currently buggy remove_all() + std::uintmax_t out = fs::stdfs::remove_all(path, ec); + + for (int i = 0; i < 5 && this->exists(path); i++) + { + using namespace std::chrono_literals; + std::this_thread::sleep_for(i * 100ms); + out += fs::stdfs::remove_all(path, ec); + } + + if (this->exists(path)) + { + System::println(System::Color::warning, "Some files in %s were unable to be removed. Close any editors operating in this directory and retry.", path.string()); + } + + return out; } virtual bool exists(const fs::path & path) const override { |
