All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.org.openrndr.ResourceUrl.kt Maven / Gradle / Ivy

package org.openrndr

import java.net.URL
import kotlin.reflect.KClass

actual fun resourceUrl(name: String, `class`: KClass<*>): String {
    val resource = `class`.java.getResource(name)
    if (resource == null) {
        throw RuntimeException("resource $name not found")
    } else {
        return resource.toExternalForm()
    }
}

actual fun resourceText(name: String, `class`: KClass<*>): String {
    return URL(resourceUrl(name)).readText()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy