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
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,
}
}

View file

@ -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()
}