From 76c45dd7c1ffdca57e30ae7109c9fe0e5768f877 Mon Sep 17 00:00:00 2001 From: Sculas Date: Thu, 8 Sep 2022 14:49:26 +0200 Subject: [PATCH] fix: make patcher version public --- src/main/kotlin/app/revanced/patcher/Patcher.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt index d3eb328f..f2439c9d 100644 --- a/src/main/kotlin/app/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/patcher/Patcher.kt @@ -39,7 +39,6 @@ import java.io.File import java.nio.file.Files private val NAMER = BasicDexFileNamer() -private val VERSION = VersionReader.read() /** * The ReVanced Patcher. @@ -51,6 +50,11 @@ class Patcher(private val options: PatcherOptions) { val data: PatcherData + companion object { + @JvmStatic + val version = VersionReader.read() + } + init { val extInputFile = ExtFile(options.inputFile) try { @@ -249,9 +253,9 @@ class Patcher(private val options: PatcherOptions) { fun addPatches(patches: Iterable>>) { for (patch in patches) { val needsVersion = patch.sincePatcherVersion - if (needsVersion != null && needsVersion > VERSION) { + if (needsVersion != null && needsVersion > version) { logger.error("Patch '${patch.patchName}' requires Patcher version $needsVersion or higher") - logger.error("Current Patcher version is $VERSION") + logger.error("Current Patcher version is $version") logger.warn("Skipping '${patch.patchName}'!") continue // TODO: continue or halt/throw? }