fix load fun for different jvm

This commit is contained in:
InsanusMokrassar 2018-09-14 17:16:20 +08:00
parent 6c7d52c321
commit a9b370d3bf
2 changed files with 6 additions and 3 deletions

View File

@ -1,7 +1,7 @@
package com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions
import com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions.models.CeilsDescriptionsRoot
import com.github.insanusmokrassar.PsychomatrixBase.utils.load
import com.github.insanusmokrassar.PsychomatrixBase.utils.FilesLoader.load
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import java.io.InputStreamReader

View File

@ -3,6 +3,9 @@ package com.github.insanusmokrassar.PsychomatrixBase.utils
import java.io.FileInputStream
import java.io.InputStream
fun load(filename: String) : InputStream {
return (ClassLoader.getSystemResourceAsStream(filename) ?: FileInputStream(filename))
object FilesLoader {
@JvmStatic
fun load(filename: String) : InputStream {
return (this::class.java.classLoader.getResourceAsStream(filename) ?: FileInputStream(filename))
}
}