fix: only accept directories when looking for files in resource patch

This commit is contained in:
danthe1st 2022-05-26 00:30:14 +02:00
parent d946333c96
commit c76da7e5ff
No known key found for this signature in database
GPG Key ID: 2F8074F370864D56

View File

@ -6,6 +6,7 @@ import app.revanced.utils.patcher.applyPatchesPrint
import app.revanced.utils.patcher.mergeFiles import app.revanced.utils.patcher.mergeFiles
import app.revanced.utils.signing.Signer import app.revanced.utils.signing.Signer
import java.io.File import java.io.File
import java.io.FileFilter
internal class Patcher { internal class Patcher {
internal companion object { internal companion object {
@ -30,7 +31,7 @@ internal class Patcher {
} }
if (MainCommand.patchResources) { if (MainCommand.patchResources) {
for (file in File(MainCommand.cacheDirectory).resolve("build/").listFiles()?.first()?.listFiles()!!) { for (file in File(MainCommand.cacheDirectory).resolve("build/").listFiles(FileFilter { it.isDirectory })?.first()?.listFiles()!!) {
if (!file.isDirectory) { if (!file.isDirectory) {
zipFileSystem.replaceFile(file.name, file.readBytes()) zipFileSystem.replaceFile(file.name, file.readBytes())
continue continue