Skip to content

Commit

Permalink
fix: return resourceFile to caller
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas committed Jun 21, 2022
1 parent 28d5468 commit 1f75777
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main/kotlin/app/revanced/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class Patcher(private val options: PatcherOptions) {
fun save(): PatcherResult {
val packageMetadata = data.packageMetadata
val metaInfo = packageMetadata.metaInfo
var resourceFile: ExtFile? = null

if (options.patchResources) {
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
Expand Down Expand Up @@ -177,9 +178,7 @@ class Patcher(private val options: PatcherOptions) {
null, includedFiles
)

// write packaged resources to cache directory
ExtFile(aaptFile).directory.copyToDir(cacheDirectory.resolve("build/"))

resourceFile = ExtFile(aaptFile)
}

val newDexFile = object : DexFile {
Expand All @@ -204,7 +203,8 @@ class Patcher(private val options: PatcherOptions) {
dexFiles.map {
app.revanced.patcher.util.dex.DexFile(it.key, it.value)
},
metaInfo.doNotCompress.toList()
metaInfo.doNotCompress.toList(),
resourceFile
)
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/app/revanced/patcher/PatcherResult.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app.revanced.patcher

import app.revanced.patcher.util.dex.DexFile
import brut.directory.ExtFile

/**
* The result of a patcher.
Expand All @@ -9,5 +10,6 @@ import app.revanced.patcher.util.dex.DexFile
*/
data class PatcherResult(
val dexFiles: List<DexFile>,
val doNotCompress: List<String>? = null
val doNotCompress: List<String>? = null,
val resourceFile: ExtFile?
)

0 comments on commit 1f75777

Please sign in to comment.