mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-01 13:44:25 +02:00
refactor: simplify code by removing the with
block
This commit is contained in:
parent
2dcbd8d079
commit
afcba5c212
@ -33,6 +33,7 @@ import org.jf.dexlib2.iface.ClassDef
|
|||||||
import org.jf.dexlib2.iface.DexFile
|
import org.jf.dexlib2.iface.DexFile
|
||||||
import org.jf.dexlib2.writer.io.MemoryDataStore
|
import org.jf.dexlib2.writer.io.MemoryDataStore
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.nio.file.Files
|
||||||
|
|
||||||
val NAMER = BasicDexFileNamer()
|
val NAMER = BasicDexFileNamer()
|
||||||
|
|
||||||
@ -162,23 +163,27 @@ class Patcher(
|
|||||||
|
|
||||||
ResXmlPatcher.fixingPublicAttrsInProviderAttributes(manifestFile)
|
ResXmlPatcher.fixingPublicAttrsInProviderAttributes(manifestFile)
|
||||||
|
|
||||||
with(cacheDirectory.resolve("aapt_temp_file")) {
|
val aaptFile = cacheDirectory.resolve("aapt_temp_file")
|
||||||
val resDirectory = cacheDirectory.resolve("res")
|
|
||||||
val includedFiles = metaInfo.usesFramework.ids.map { id ->
|
|
||||||
androlibResources.getFrameworkApk(
|
|
||||||
id,
|
|
||||||
metaInfo.usesFramework.tag
|
|
||||||
)
|
|
||||||
}.toTypedArray()
|
|
||||||
|
|
||||||
androlibResources.aaptPackage(
|
// delete if it exists
|
||||||
this, manifestFile, resDirectory, null,
|
Files.deleteIfExists(aaptFile.toPath())
|
||||||
null, includedFiles
|
|
||||||
|
val resDirectory = cacheDirectory.resolve("res")
|
||||||
|
val includedFiles = metaInfo.usesFramework.ids.map { id ->
|
||||||
|
androlibResources.getFrameworkApk(
|
||||||
|
id,
|
||||||
|
metaInfo.usesFramework.tag
|
||||||
)
|
)
|
||||||
|
}.toTypedArray()
|
||||||
|
|
||||||
|
androlibResources.aaptPackage(
|
||||||
|
aaptFile, manifestFile, resDirectory, null,
|
||||||
|
null, includedFiles
|
||||||
|
)
|
||||||
|
|
||||||
|
// write packaged resources to cache directory
|
||||||
|
ExtFile(aaptFile).directory.copyToDir(cacheDirectory.resolve("build/"))
|
||||||
|
|
||||||
// write packaged resources to cache directory
|
|
||||||
ExtFile(this).directory.copyToDir(cacheDirectory.resolve("build/"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val newDexFile = object : DexFile {
|
val newDexFile = object : DexFile {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user