operating System
The runtime operating system of the current platform.
This is not necessarily the same as the compilation target. For example, a JVM compiled app can run on any operating system that supports a JVM.
Example usage:
val platform = KPlatform()
if (platform.operatingSystem.isWindows) {
// Execute code that should only run on Windows
}
// or use a switch
when (platform.operatingSystem) {
is OperatingSystem.Windows -> {
// Execute code that should only run on Windows
}
else -> {
// Do something else
}
}
Content copied to clipboard