Skip to content

Commit

Permalink
feat: add path for cacheDirectory and enable resource patching by d…
Browse files Browse the repository at this point in the history
…efault
  • Loading branch information
oSumAtrIX committed Jun 3, 2022
1 parent bd18513 commit 54c0a03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/app/revanced/cli/MainCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/app/revanced/cli/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 54c0a03

Please sign in to comment.