From f3a3e935a2ad924c3186d5c1bf23e20f8f836da0 Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Tue, 21 Jun 2022 19:31:49 +0200 Subject: [PATCH] refactor: prevent any future regressions in zipfs --- .../app/revanced/utils/filesystem/ZipFileSystemUtils.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/app/revanced/utils/filesystem/ZipFileSystemUtils.kt b/src/main/kotlin/app/revanced/utils/filesystem/ZipFileSystemUtils.kt index d8333cf..95cafc5 100644 --- a/src/main/kotlin/app/revanced/utils/filesystem/ZipFileSystemUtils.kt +++ b/src/main/kotlin/app/revanced/utils/filesystem/ZipFileSystemUtils.kt @@ -13,6 +13,10 @@ internal class ZipFileSystemUtils( private var zipFileSystem = FileSystems.newFileSystem(file.toPath(), mapOf("noCompression" to true)) private fun Path.deleteRecursively() { + if (!Files.exists(this)) { + throw IllegalStateException("File exists in real folder but not in zip file system") + } + if (Files.isDirectory(this)) { Files.list(this).forEach { path -> path.deleteRecursively()