Use defs to compile for macOS directories

This commit is contained in:
Kayden Tebau 2022-12-17 19:26:26 -08:00
parent deee285e71
commit a2c399557e
No known key found for this signature in database
GPG key ID: 933A1F44222C2634
3 changed files with 18 additions and 4 deletions

6
compile-macos.hxml Normal file
View file

@ -0,0 +1,6 @@
-cp src
-lib heaps
-lib hlsdl
-hl native/marblegame.c
-D MACOS_BUNDLE
--main Main

View file

@ -22,7 +22,11 @@ import src.Settings;
class ResourceLoader { class ResourceLoader {
#if (hl && !android) #if (hl && !android)
#if MACOS_BUNDLE
public static var fileSystem:FileSystem = new TorqueFileSystem(Path.normalize(Path.join([Path.directory(Sys.programPath()), "..", "Resources"])), null); public static var fileSystem:FileSystem = new TorqueFileSystem(Path.normalize(Path.join([Path.directory(Sys.programPath()), "..", "Resources"])), null);
#else
public static var fileSystem:FileSystem = new TorqueFileSystem(".", null);
#end
#end #end
#if (js || android) #if (js || android)
public static var fileSystem:FileSystem = null; public static var fileSystem:FileSystem = null;

View file

@ -156,8 +156,13 @@ class Settings {
public static var isTouch:Option<Bool> = Option.None; public static var isTouch:Option<Bool> = Option.None;
public static var settingsDir = Path.join([Sys.getEnv("HOME"), #if hl
"Library", "Application Support", "MBHaxe-MBP"]); #if MACOS_BUNDLE
public static var settingsDir = Path.join([Sys.getEnv("HOME"), "Library", "Application Support", "MBHaxe-MBP"]);
#else
public static var settingsDir = ".";
#end
#end
public static function applySettings() { public static function applySettings() {
#if hl #if hl
@ -277,8 +282,7 @@ class Settings {
if (settingsExists) { if (settingsExists) {
#if hl #if hl
var json = var json = Json.parse(File.getContent(Path.join([settingsDir, "settings.json"])));
Json.parse(File.getContent(Path.join([settingsDir, "settings.json"])));
#end #end
#if js #if js
var json = Json.parse(localStorage.getItem("MBHaxeSettings")); var json = Json.parse(localStorage.getItem("MBHaxeSettings"));