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!
This commit is contained in:
JeremyStar™ 2024-12-17 03:55:07 +01:00
parent bf449971e9
commit d5a03c885b
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 18 additions and 8 deletions

View file

@ -21,11 +21,7 @@
package de.staropensource.engine.base.utility package de.staropensource.engine.base.utility
import de.staropensource.engine.base.Engine.Companion.logger 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.*
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 oshi.PlatformEnum import oshi.PlatformEnum
import oshi.SystemInfo import oshi.SystemInfo
@ -80,6 +76,7 @@ class Environment private constructor() {
PlatformEnum.OPENBSD -> operatingSystem = OPENBSD 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.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.WINDOWS, PlatformEnum.WINDOWSCE -> operatingSystem = WINDOWS
PlatformEnum.MACOS -> operatingSystem = MACOS
else -> logger.crash("Unsupported operating system '" + os.family + "'") else -> logger.crash("Unsupported operating system '" + os.family + "'")
} }
} }
@ -154,5 +151,14 @@ class Environment private constructor() {
* @since v1-alpha10 * @since v1-alpha10
*/ */
WINDOWS, 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,
} }
} }

View file

@ -149,17 +149,20 @@ class FileAccess {
// Storage // Storage
homeDirectory = FileAccess(System.getProperty("user.home")) homeDirectory = FileAccess(System.getProperty("user.home"))
.createDirectory().verifyIsDirectory() .createDirectory()
.verifyIsDirectory()
configDirectory = FileAccess(when (Environment.operatingSystem) { configDirectory = FileAccess(when (Environment.operatingSystem) {
LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.config" 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" else -> "${homeDirectory}/.sosengine/config"
}).createDirectory().verifyIsDirectory() }).createDirectory().verifyIsDirectory()
dataDirectory = FileAccess(when (Environment.operatingSystem) { dataDirectory = FileAccess(when (Environment.operatingSystem) {
LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.local/share" 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" else -> "${homeDirectory}/.sosengine/data"
}).createDirectory().verifyIsDirectory() }).createDirectory().verifyIsDirectory()
@ -174,6 +177,7 @@ class FileAccess {
persistentCacheDirectory = FileAccess(when (Environment.operatingSystem) { persistentCacheDirectory = FileAccess(when (Environment.operatingSystem) {
LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.cache" LINUX, FREEBSD, NETBSD, OPENBSD -> "${homeDirectory}/.cache"
WINDOWS -> "${homeDirectory}/AppData/Local/Temp" WINDOWS -> "${homeDirectory}/AppData/Local/Temp"
MACOS -> "${homeDirectory}/Library/Caches"
else -> "${homeDirectory}/.sosengine/persistent-cache" else -> "${homeDirectory}/.sosengine/persistent-cache"
}).createDirectory().verifyIsDirectory() }).createDirectory().verifyIsDirectory()
} }