From 665a56b0b494079949ee4f64f71fe7276b8c7ca8 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Tue, 7 Oct 2014 04:55:14 +0200 Subject: [PATCH] (iOS) Properly implement this - seems to fix the issue on second startup with the simulator --- apple/iOS/platform.m | 6 ++++-- frontend/platform/platform_apple.c | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index 259e74f2ea..b9c82a1392 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -180,8 +180,6 @@ static void handle_touch_event(NSArray* touches) - (void)applicationDidFinishLaunching:(UIApplication *)application { - const char *paths; - apple_platform = self; [self setDelegate:self]; @@ -190,6 +188,9 @@ static void handle_touch_event(NSArray* touches) [self showPauseMenu:self]; [self.window makeKeyAndVisible]; +#if 0 + const char *paths; + // Build system paths and test permissions self.documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; fill_pathname_join(g_defaults.system_dir, self.documentsDirectory.UTF8String, ".RetroArch", sizeof(g_defaults.system_dir)); @@ -222,6 +223,7 @@ static void handle_touch_event(NSArray* touches) apple_display_alert(msg, "Error"); } } +#endif [self pushViewController:[RAMainMenu new] animated:YES]; diff --git a/frontend/platform/platform_apple.c b/frontend/platform/platform_apple.c index 802fa67ec9..93c2345ebc 100644 --- a/frontend/platform/platform_apple.c +++ b/frontend/platform/platform_apple.c @@ -117,7 +117,7 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[], void *args, void *params_data) { - char bundle_path_buf[PATH_MAX + 1]; + char bundle_path_buf[PATH_MAX + 1], home_dir_buf[PATH_MAX + 1]; CFURLRef bundle_url; CFBundleRef bundle = CFBundleGetMainBundle(); if (!bundle) @@ -126,7 +126,6 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[], CFStringRef bundle_path = CFURLCopyPath(bundle_url); #ifdef IOS -#if 0 CFURLRef home_dir = CFCopyHomeDirectoryURL(); int doc_len = 10; /* Length of "/Documents" */ int pre_len = 7; /* Length of "file://" */ @@ -135,8 +134,10 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[], CFURLGetFileSystemRepresentation(home_dir, true, dd_bs, dd_len - pre_len); /* We subtract another 1 to get the NUL */ strlcpy((char *)(dd_bs + dd_len - pre_len - 1), "/Documents", doc_len + 1); + + CFStringRef home_dir_ref = CFURLCopyPath(home_dir); - CFStringGetCString(home_dir, home_dir_buf, sizeof(home_dir_buf), kCFStringEncodingUTF8); + CFStringGetCString(home_dir_ref, home_dir_buf, sizeof(home_dir_buf), kCFStringEncodingUTF8); CFStringGetCString(bundle_path, bundle_path_buf, sizeof(bundle_path_buf), kCFStringEncodingUTF8); fill_pathname_join(g_defaults.system_dir, home_dir_buf, ".RetroArch", sizeof(g_defaults.system_dir)); @@ -150,7 +151,7 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[], path_mkdir(bundle_path_buf); - if (access(paths, 0755) != 0) + if (access(bundle_path_buf, 0755) != 0) RARCH_ERR("Failed to create or access base directory: %s\n", bundle_path_buf); else { @@ -161,7 +162,6 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[], } CFRelease(home_dir); -#endif #endif CFRelease(bundle_path);