refactor: prevent any future regressions in zipfs

This commit is contained in:
Lucaskyy 2022-06-21 19:31:49 +02:00
parent c272d55e2d
commit f3a3e935a2
No known key found for this signature in database
GPG Key ID: 1530BFF96D1EEB89

View File

@ -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()