Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DevScyu committed Oct 29, 2024
1 parent 33e9b48 commit 9fefcbb
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import kotlinx.io.asSource
import kotlinx.io.buffered
import kotlinx.io.files.Path
import java.io.File
import java.io.InputStream
import java.nio.file.FileSystems
import java.util.jar.JarFile
import kotlin.io.path.*
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.isRegularFile
import kotlin.io.path.pathString
import kotlin.io.path.walk
import kotlin.reflect.KClass

object PrefabsDSLExtensions {
Expand Down Expand Up @@ -72,8 +75,8 @@ object PrefabsDSLExtensions {
yieldAll(directoryPath.walk().filter { it.isRegularFile() }.map {
JarResource(
classLoader,
path = it.toString().substringAfter(directoryPath.toString()).removePrefix("/"),
resource = it.toString()
path = it.toString().substringAfter(directoryPath.toString()).removePrefix(FileSystems.getDefault().separator),
resource = directory + it.toString().substringAfter(directoryPath.toString())
)
})
}
Expand Down Expand Up @@ -101,8 +104,14 @@ object PrefabsDSLExtensions {
val path: String,
val resource: String
) {
val nameWithoutExt = path.substringAfterLast("/").substringBeforeLast(".")
val nameWithoutExt = path.substringAfterLast(FileSystems.getDefault().separator).substringBeforeLast(".")
val ext = path.substringAfterLast(".")
val stream = classLoader.getResourceAsStream(resource)!!

init {
println("[Geary] Loading prefab from resource: ${this.path}")
println("[Geary] Resource: ${this.resource}")
println("[Geary] Name: ${this.nameWithoutExt} ${this.ext}")
}
}
}

0 comments on commit 9fefcbb

Please sign in to comment.