All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.smithy.kotlin.runtime.util.Platform.kt Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

package aws.smithy.kotlin.runtime.util

public interface PlatformEnvironProvider : EnvironmentProvider, PropertyProvider
public interface PlatformProvider : PlatformEnvironProvider, Filesystem {
    /**
     * Get the operating system info
     */
    fun osInfo(): OperatingSystem
}

/**
 * System default implementation of [PlatformProvider]
 */
@InternalApi
public expect object Platform : PlatformProvider {
    val isJvm: Boolean
    val isAndroid: Boolean
    val isBrowser: Boolean
    val isNode: Boolean
    val isNative: Boolean
}

data class OperatingSystem(val family: OsFamily, val version: String?)

public enum class OsFamily {
    Linux,
    MacOs,
    Windows,
    Android,
    Ios,
    Unknown;

    override fun toString(): String = when (this) {
        Linux -> "linux"
        MacOs -> "macos"
        Windows -> "windows"
        Android -> "android"
        Ios -> "ios"
        Unknown -> "unknown"
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy