Skip to content

Commit

Permalink
fix: Close files so the assets folder can be removed
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-psi committed Jan 19, 2024
1 parent 2f1eab8 commit a91ae77
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions inspector/src/main/kotlin/inspector/util/Extension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ object Extension {
.filter { it.isFile }
.forEach {
zos.putNextEntry(ZipEntry(it.relativeTo(assetsFolder).toString().replace('\\', '/')))
it.inputStream().copyTo(zos)
it.inputStream().run {
copyTo(zos)
close()
}
zos.closeEntry()
}

Expand All @@ -118,6 +121,9 @@ object Extension {

jarFile.delete()
tempJarFile.renameTo(jarFile)
assetsFolder.deleteRecursively()

if (!assetsFolder.deleteRecursively()) {
throw Exception("Could not delete assets folder.")
}
}
}

0 comments on commit a91ae77

Please sign in to comment.