feat: add path for cacheDirectory and enable resource patching by default

This commit is contained in:
oSumAtrIX 2022-06-03 17:51:13 +02:00
parent bd185133bc
commit 54c0a03d44
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 6 additions and 6 deletions

View File

@ -22,11 +22,11 @@ internal object MainCommand : Runnable {
@Option(names = ["-p", "--patches"], description = ["One or more bundles of patches"]) @Option(names = ["-p", "--patches"], description = ["One or more bundles of patches"])
internal var patchBundles = arrayOf<String>() internal var patchBundles = arrayOf<String>()
@Option(names = ["-t", "--temp-dir"], description = ["Temporal resource cache directory"], required = true) @Option(names = ["-t", "--temp-dir"], description = ["Temporal resource cache directory"])
internal lateinit var cacheDirectory: String internal var cacheDirectory = "revanced-cache"
@Option(names = ["-r", "--resource-patcher"], description = ["Enable patching resources"]) @Option(names = ["-r", "--resource-patcher"], description = ["Disable patching resources"])
internal var patchResources: Boolean = false internal var disableResourcePatching: Boolean = false
@Option( @Option(
names = ["-c", "--clean"], names = ["-c", "--clean"],
@ -65,7 +65,7 @@ internal object MainCommand : Runnable {
return return
} }
val patcher = app.revanced.patcher.Patcher(PatcherOptions(inputFile, cacheDirectory, patchResources)) val patcher = app.revanced.patcher.Patcher(PatcherOptions(inputFile, cacheDirectory, !disableResourcePatching))
if (signatureCheck) { if (signatureCheck) {
patcher.addPatchesFiltered() patcher.addPatchesFiltered()

View File

@ -30,7 +30,7 @@ internal class Patcher {
zipFileSystem.replaceFile(name, data.data) zipFileSystem.replaceFile(name, data.data)
} }
if (MainCommand.patchResources) { if (!MainCommand.disableResourcePatching) {
for (file in File(MainCommand.cacheDirectory).resolve("build/").listFiles(FileFilter { it.isDirectory }) for (file in File(MainCommand.cacheDirectory).resolve("build/").listFiles(FileFilter { it.isDirectory })
?.first()?.listFiles()!!) { ?.first()?.listFiles()!!) {
if (!file.isDirectory) { if (!file.isDirectory) {