fix Unzip::intoDir not deleting the zip after

This commit is contained in:
HJfod 2022-12-08 13:08:45 +02:00
parent 037602ecea
commit 9da9493816

View file

@ -308,8 +308,12 @@ Result<> Unzip::intoDir(
Path const& to,
bool deleteZipAfter
) {
GEODE_UNWRAP_INTO(auto unzip, Unzip::create(from));
GEODE_UNWRAP(unzip.extractAllTo(to));
// scope to ensure the zip is closed after extracting so the zip can be
// removed
{
GEODE_UNWRAP_INTO(auto unzip, Unzip::create(from));
GEODE_UNWRAP(unzip.extractAllTo(to));
}
if (deleteZipAfter) {
try { ghc::filesystem::remove(from); } catch(...) {}
}