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