fix: Only open files for reading and writing if writeable

This commit is contained in:
oSumAtrIX 2023-09-21 23:42:20 +02:00
parent f199298317
commit 3846f721ca
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -13,7 +13,7 @@ import java.util.zip.Deflater
class ZipFile(file: File) : Closeable {
private var entries: MutableList<ZipEntry> = mutableListOf()
private val filePointer: RandomAccessFile = RandomAccessFile(file, "rw")
private val filePointer: RandomAccessFile = RandomAccessFile(file, if (file.canWrite()) "rw" else "r")
private var centralDirectoryNeedsRewrite = false
private val compressionLevel = 5