mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: detection installation type
This commit is contained in:
21
src/main/kotlin/app/termora/AppLayout.kt
Normal file
21
src/main/kotlin/app/termora/AppLayout.kt
Normal file
@@ -0,0 +1,21 @@
|
||||
package app.termora
|
||||
|
||||
enum class AppLayout {
|
||||
/**
|
||||
* Windows
|
||||
*/
|
||||
Zip,
|
||||
Exe,
|
||||
|
||||
/**
|
||||
* macOS
|
||||
*/
|
||||
App,
|
||||
|
||||
/**
|
||||
* Linux
|
||||
*/
|
||||
TarGz,
|
||||
AppImage,
|
||||
Deb,
|
||||
}
|
||||
@@ -121,6 +121,30 @@ object Application {
|
||||
return version
|
||||
}
|
||||
|
||||
fun getLayout(): AppLayout {
|
||||
if (SystemInfo.isMacOS) return AppLayout.App
|
||||
|
||||
val layout = System.getProperty("jpackage.app-layout")
|
||||
if (SystemInfo.isLinux) {
|
||||
if ("deb" == layout) {
|
||||
return AppLayout.Deb
|
||||
} else if ("tar.gz" == layout) {
|
||||
return AppLayout.TarGz
|
||||
}
|
||||
}
|
||||
|
||||
if (SystemInfo.isWindows) {
|
||||
if ("exe" == layout) {
|
||||
return AppLayout.Exe
|
||||
} else if ("zip" == layout) {
|
||||
return AppLayout.Zip
|
||||
}
|
||||
}
|
||||
|
||||
return if (SystemInfo.isWindows) AppLayout.Exe else AppLayout.AppImage
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 未知版本通常是开发版本
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user