mirror of https://github.com/microsoft/vcpkg.git
Workaround for fs::remove_all()
This commit is contained in:
parent
11d6aa60b2
commit
5a4e7ff1b6
|
|
@ -1,6 +1,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "vcpkg_Files.h"
|
#include "vcpkg_Files.h"
|
||||||
#include "vcpkg_System.h"
|
#include "vcpkg_System.h"
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
namespace vcpkg::Files
|
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
|
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
|
virtual bool exists(const fs::path & path) const override
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue