summaryrefslogtreecommitdiff
path: root/plugin/src/main/kotlin/moe/nea/archenemy/util/OSUtil.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/src/main/kotlin/moe/nea/archenemy/util/OSUtil.kt')
-rw-r--r--plugin/src/main/kotlin/moe/nea/archenemy/util/OSUtil.kt27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugin/src/main/kotlin/moe/nea/archenemy/util/OSUtil.kt b/plugin/src/main/kotlin/moe/nea/archenemy/util/OSUtil.kt
new file mode 100644
index 0000000..bd7a158
--- /dev/null
+++ b/plugin/src/main/kotlin/moe/nea/archenemy/util/OSUtil.kt
@@ -0,0 +1,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"
+ }
+ }
+} \ No newline at end of file