mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-05 03:13:00 +01:00
fix: Use correct class loader to load resources
This commit is contained in:
parent
f9a5dc6c91
commit
1d5f1f83be
@ -8,6 +8,8 @@ import org.w3c.dom.Node
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
private val classLoader = object {}.javaClass.classLoader
|
||||
|
||||
/**
|
||||
* Recursively traverse the DOM tree starting from the given root node.
|
||||
*
|
||||
@ -45,7 +47,6 @@ fun ResourceContext.mergeStrings(host: String) {
|
||||
* @param resources The resources to copy.
|
||||
*/
|
||||
fun ResourceContext.copyResources(sourceResourceDirectory: String, vararg resources: ResourceGroup) {
|
||||
val classLoader = javaClass.classLoader
|
||||
val targetResourceDirectory = this["res"]
|
||||
|
||||
for (resourceGroup in resources) {
|
||||
@ -77,7 +78,7 @@ fun ResourceContext.iterateXmlNodeChildren(
|
||||
targetTag: String,
|
||||
callback: (node: Node) -> Unit
|
||||
) =
|
||||
xmlEditor[javaClass.classLoader.getResourceAsStream(resource)!!].use {
|
||||
xmlEditor[classLoader.getResourceAsStream(resource)!!].use {
|
||||
val stringsNode = it.file.getElementsByTagName(targetTag).item(0).childNodes
|
||||
for (i in 1 until stringsNode.length - 1) callback(stringsNode.item(i))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user