summaryrefslogtreecommitdiff
path: root/plugin/src/main/kotlin/moe/nea/archenemy/util/OSUtil.kt
blob: bd7a15863cb44e886ba45604a264b6f9a7502c17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package moe.nea.archenemy.util


object OSUtil {
	// TODO: replace this with a library
	enum class OsKind {
		WINDOWS,
		LINUX,
		OSX,
	}

	fun getOs(): OsKind {
		val osName = System.getProperty("os.name").lowercase()
		if (osName.contains("win")) return OsKind.WINDOWS
		if (osName.contains("nix") || osName.contains("nux")) return OsKind.LINUX
		if (osName.contains("mac")) return OsKind.OSX
		error("Unknown OS")
	}

	fun getOsClassifier(): String {
		return when (getOs()) {
			OsKind.WINDOWS -> "windows"
			OsKind.LINUX -> "linux"
			OsKind.OSX -> "osx"
		}
	}
}