From ea767f79622e56f0effddc069fbd89f2d4d5bf19 Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh Date: Sun, 14 May 2023 16:38:37 +0700 Subject: [PATCH] Makefile: add Mac Catalyst (PLATFORM=6) Build for Mac Catalyst is mainly for debugging purpose on Apple Silicon Macs. --- Makefile | 3 +++ Natives/main.m | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index eb54fdc9..d8e931b9 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,9 @@ $(warning Set PLATFORM to 2, which is equal to iOS.) else ifeq ($(PLATFORM),3) PLATFORM_NAME := tvos $(warning Set PLATFORM to 3, which is equal to tvOS.) +else ifeq ($(PLATFORM),6) +PLATFORM_NAME := maccatalyst +$(warning Set PLATFORM to 6, which is equal to Mac Catalyst.) else ifeq ($(PLATFORM),7) PLATFORM_NAME := iossimulator $(warning Set PLATFORM to 7, which is equal to iOS Simulator.) diff --git a/Natives/main.m b/Natives/main.m index b0bb677d..abf872b7 100644 --- a/Natives/main.m +++ b/Natives/main.m @@ -300,11 +300,9 @@ void init_setupHomeDirectory() { NSString *homeDir; NSError *homeError; - if ([@(getenv("HOME")) isEqualToString:@"/var/mobile"]) { - homeDir = @"/var/mobile/Documents/PojavLauncher"; - } else { - homeDir = [NSString stringWithFormat:@"%s/Documents", getenv("HOME")]; - } + BOOL isNotSandboxed = [@(getenv("HOME")).lastPathComponent isEqualToString:NSUserName()]; + homeDir = [NSString stringWithFormat:@"%s/Documents%@", getenv("HOME"), + isNotSandboxed ? @"/PojavLauncher":@""]; if (![fm fileExistsAtPath:homeDir] ) { [fm createDirectoryAtPath:homeDir withIntermediateDirectories:NO attributes:nil error:&homeError];