chore: Print correct error message

This commit is contained in:
oSumAtrIX 2023-09-06 14:23:26 +02:00
parent 81d1d7f544
commit 909d89fa8d
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -93,11 +93,16 @@ class TestPatchAnnotationProcessor {
* @param className The name of the class to get the source file from.
* @return The source file.
*/
fun getSourceFile(sample: String, className: String) = SourceFile.kotlin(
"$className.kt", TestPatchAnnotationProcessor::class.java.classLoader.getResourceAsStream(
"app/revanced/patcher/patch/annotations/processor/samples/$sample/$className.kt"
)?.readAllBytes()?.toString(Charsets.UTF_8) ?: error("Could not find resource $className")
)
fun getSourceFile(sample: String, className: String): SourceFile {
val resourceName = "app/revanced/patcher/patch/annotations/processor/samples/$sample/$className.kt"
return SourceFile.kotlin(
"$className.kt",
TestPatchAnnotationProcessor::class.java.classLoader.getResourceAsStream(resourceName)
?.readAllBytes()
?.toString(Charsets.UTF_8)
?: error("Could not find resource $resourceName")
)
}
/**
* Compile the given source files and return the result.