From d5a03c885b783d0070bf0a922cd4551200b0c298 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 17 Dec 2024 03:55:07 +0100 Subject: [PATCH] Add support for macOS Just had to install macOS in a VM using QuickEmu (many thanks to them!) to add support for this. After installing it, creating an Apple account just to download Xcode, install OpenJDK using Homebrew and then using JShell and some searching I can confidently say that I find it hilarious that this piece of garbage exists. No keyboard shortcuts work (likely because of that Command key thingy), everything is clunky as hell and nothing really makes sense. How can anybody use this piece of overpriced shit? Anyway, for these four rich kiddies which want to run their favourite game on their parent's Macbook can do that now. In case you need to install shitOS too: https://github.com/quickemu-project/quickemu/wiki/03-Create-macOS-virtual-machines They make it incredibly easy to do, so big shoutouts to them! --- .../engine/base/utility/Environment.kt | 16 +++++++++++----- .../engine/base/utility/FileAccess.kt | 10 +++++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/Environment.kt b/base/src/main/kotlin/de/staropensource/engine/base/utility/Environment.kt index cef6844..122a806 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/utility/Environment.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/utility/Environment.kt @@ -21,11 +21,7 @@ package de.staropensource.engine.base.utility import de.staropensource.engine.base.Engine.Companion.logger -import de.staropensource.engine.base.utility.Environment.OperatingSystem.FREEBSD -import de.staropensource.engine.base.utility.Environment.OperatingSystem.LINUX -import de.staropensource.engine.base.utility.Environment.OperatingSystem.NETBSD -import de.staropensource.engine.base.utility.Environment.OperatingSystem.OPENBSD -import de.staropensource.engine.base.utility.Environment.OperatingSystem.WINDOWS +import de.staropensource.engine.base.utility.Environment.OperatingSystem.* import oshi.PlatformEnum import oshi.SystemInfo @@ -80,6 +76,7 @@ class Environment private constructor() { PlatformEnum.OPENBSD -> operatingSystem = OPENBSD //PlatformEnum.ANDROID -> Environment.operatingSystem = Environment.OperatingSystem.ANDROID // android is not yet supported by the engine, have to figure that one out sometime PlatformEnum.WINDOWS, PlatformEnum.WINDOWSCE -> operatingSystem = WINDOWS + PlatformEnum.MACOS -> operatingSystem = MACOS else -> logger.crash("Unsupported operating system '" + os.family + "'") } } @@ -154,5 +151,14 @@ class Environment private constructor() { * @since v1-alpha10 */ WINDOWS, + + /** + * Identifies that the application is running + * under [macOS](https://apple.com/macos), and + * by extension under the [XNU kernel](https://github.com/apple-oss-distributions/xnu). + * + * @since v1-alpha10 + */ + MACOS, } } diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt b/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt index 224b038..53711fc 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt @@ -149,17 +149,20 @@ class FileAccess { // Storage homeDirectory = FileAccess(System.getProperty("user.home")) - .createDirectory().verifyIsDirectory() + .createDirectory() + .verifyIsDirectory() configDirectory = FileAccess(when (Environment.operatingSystem) { LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.config" - WINDOWS -> "${homeDirectory}/AppData/Roaming/sosengine-config" + WINDOWS -> "${homeDirectory}/AppData/Roaming/sosengine/config" + MACOS -> "${homeDirectory}/Library/Application Support/sosengine/config" else -> "${homeDirectory}/.sosengine/config" }).createDirectory().verifyIsDirectory() dataDirectory = FileAccess(when (Environment.operatingSystem) { LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.local/share" - WINDOWS -> "${homeDirectory}/AppData/Roaming/sosengine-data" + WINDOWS -> "${homeDirectory}/AppData/Roaming/sosengine/data" + MACOS -> "${homeDirectory}/Library/Application Support/sosengine/data" else -> "${homeDirectory}/.sosengine/data" }).createDirectory().verifyIsDirectory() @@ -174,6 +177,7 @@ class FileAccess { persistentCacheDirectory = FileAccess(when (Environment.operatingSystem) { LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.cache" WINDOWS -> "${homeDirectory}/AppData/Local/Temp" + MACOS -> "${homeDirectory}/Library/Caches" else -> "${homeDirectory}/.sosengine/persistent-cache" }).createDirectory().verifyIsDirectory() }