Skip to content

Commit

Permalink
fix: Only open files for reading and writing if writeable
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Sep 23, 2023
1 parent f199298 commit 3846f72
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3846f72

Please sign in to comment.