From 8ddc6e9d6f3c41c1528e0d43156d7d811dd6be40 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 24 Sep 2023 22:36:37 +0200 Subject: [PATCH 1/2] fix: Check if file exists before trying to open it --- src/main/kotlin/app/revanced/library/zip/ZipFile.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/library/zip/ZipFile.kt b/src/main/kotlin/app/revanced/library/zip/ZipFile.kt index 8e1d147..1b652ec 100644 --- a/src/main/kotlin/app/revanced/library/zip/ZipFile.kt +++ b/src/main/kotlin/app/revanced/library/zip/ZipFile.kt @@ -13,7 +13,12 @@ import java.util.zip.Deflater class ZipFile(file: File) : Closeable { private var entries: MutableList = mutableListOf() - private val filePointer: RandomAccessFile = RandomAccessFile(file, if (file.canWrite()) "rw" else "r") + // Open file for writing if it doesn't exist (because the intention is to write) or is writable. + private val filePointer: RandomAccessFile = RandomAccessFile( + file, + if (!file.exists() || file.canWrite()) "rw" else "r" + ) + private var centralDirectoryNeedsRewrite = false private val compressionLevel = 5 From f0b3eb7800451b984e952134b7a7741fe26d3543 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 24 Sep 2023 20:40:37 +0000 Subject: [PATCH 2/2] chore(release): 1.0.1-dev.1 [skip ci] ## [1.0.1-dev.1](https://github.com/ReVanced/revanced-library/compare/v1.0.0...v1.0.1-dev.1) (2023-09-24) ### Bug Fixes * Check if file exists before trying to open it ([8ddc6e9](https://github.com/ReVanced/revanced-library/commit/8ddc6e9d6f3c41c1528e0d43156d7d811dd6be40)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12ae600..7f84c31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.0.1-dev.1](https://github.com/ReVanced/revanced-library/compare/v1.0.0...v1.0.1-dev.1) (2023-09-24) + + +### Bug Fixes + +* Check if file exists before trying to open it ([8ddc6e9](https://github.com/ReVanced/revanced-library/commit/8ddc6e9d6f3c41c1528e0d43156d7d811dd6be40)) + # 1.0.0 (2023-09-23) diff --git a/gradle.properties b/gradle.properties index 0cfc02d..663f564 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 1.0.0 +version = 1.0.1-dev.1