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

View File

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