From fa1b3674fc522d9e2bc68c7b866ec0db1a6f55a1 Mon Sep 17 00:00:00 2001 From: Jens Pots Date: Thu, 30 May 2024 14:19:16 +0200 Subject: [PATCH] fix: use resource contents directly --- build.gradle.kts | 2 +- src/main/kotlin/parser/Parser.kt | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f4ce4d0..dcc355d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { /** JVM Runner configuration. */ group = "technology.idlab" -version = "0.0.3" +version = "0.0.4" /** Set the Kotlin JVM version to 17. */ kotlin { jvmToolchain(17) } diff --git a/src/main/kotlin/parser/Parser.kt b/src/main/kotlin/parser/Parser.kt index 61a03e4..25e6de4 100644 --- a/src/main/kotlin/parser/Parser.kt +++ b/src/main/kotlin/parser/Parser.kt @@ -16,14 +16,13 @@ class Parser(file: File) { private val model = this::class .java - .getResource("/pipeline.ttl") - .let { it ?: Log.shared.fatal("Pipeline file not found") } + .getResourceAsStream("/pipeline.ttl") + .let { it ?: Log.shared.fatal("Pipeline ontology not found") } + .readAllBytes() .let { - try { - File(it.path) - } catch (e: Exception) { - Log.shared.fatal("Pipeline ${it.path} not found") - } + val f = File.createTempFile("pipeline", ".ttl") + f.writeBytes(it) + return@let f } .readModelRecursively()