fix: return resourceFile to caller

This commit is contained in:
Lucaskyy 2022-06-21 20:43:47 +02:00
parent 28d5468b07
commit 1f75777cf9
No known key found for this signature in database
GPG key ID: 1530BFF96D1EEB89
2 changed files with 7 additions and 5 deletions

View file

@ -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)
@ -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 {
@ -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
)
}

View file

@ -1,6 +1,7 @@
package app.revanced.patcher
import app.revanced.patcher.util.dex.DexFile
import brut.directory.ExtFile
/**
* The result of a patcher.
@ -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?
)