This commit is contained in:
nelle 2024-02-16 17:04:07 -07:00
parent 13d2fb103e
commit 6f0e963be8

View file

@ -1,14 +1,16 @@
package org.bm00.DataAccessor
import jexer.TApplication
import jexer.demos.DemoApplication
import org.bm00.DataAccessor.windows.WelcomeWindow
import java.util.*
enum class OS {
WINDOWS, LINUX, MAC, SOLARIS
WINDOWS, LINUX, MAC
}
fun getOS(): OS? {
val isJexer = System.getProperty("jexer.Swing")
val os = System.getProperty("os.name").lowercase(Locale.getDefault())
return when {
os.contains("win") -> {
@ -20,9 +22,6 @@ fun getOS(): OS? {
os.contains("mac") -> {
OS.MAC
}
os.contains("sunos") -> {
OS.SOLARIS
}
else -> null
}
}
@ -34,9 +33,12 @@ val backendType =
when (getOS())
{
OS.WINDOWS -> TApplication.BackendType.SWING
OS.LINUX -> TApplication.BackendType.SWING
OS.MAC -> TApplication.BackendType.SWING
OS.SOLARIS -> TApplication.BackendType.SWING
OS.LINUX -> if (System.getProperty("jexer.Swing", "true") == "false") {
TApplication.BackendType.XTERM
} else {
TApplication.BackendType.SWING
}
else -> throw Exception("Operating System could not be detected!")
}
@ -44,5 +46,6 @@ val backendType =
class Application : TApplication(backendType, 80, 40, 18) {
init {
WelcomeWindow(this)
}
}