From 9da9493816b2f088632b77f12662c3b31e65f01f Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Thu, 8 Dec 2022 13:08:45 +0200 Subject: [PATCH] fix Unzip::intoDir not deleting the zip after --- loader/src/utils/file.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/loader/src/utils/file.cpp b/loader/src/utils/file.cpp index bbc66685..636fca45 100644 --- a/loader/src/utils/file.cpp +++ b/loader/src/utils/file.cpp @@ -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(...) {} }