diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m index e27c38fcccc..970dd376e6a 100644 --- a/frontend/drivers/platform_darwin.m +++ b/frontend/drivers/platform_darwin.m @@ -704,7 +704,7 @@ static enum frontend_architecture frontend_darwin_get_arch(void) static int frontend_darwin_parse_drive_list(void *data, bool load_content) { int ret = -1; -#if TARGET_OS_IPHONE +#if TARGET_OS_IPHONE || defined(HAVE_APPLE_STORE) #ifdef HAVE_MENU struct string_list *str_list = NULL; file_list_t *list = (file_list_t*)data; @@ -733,7 +733,7 @@ static int frontend_darwin_parse_drive_list(void *data, bool load_content) FILE_TYPE_DIRECTORY, 0, 0, NULL); string_list_free(str_list); -#if TARGET_OS_IOS +#if !TARGET_OS_TV if ( filebrowser_get_type() == FILEBROWSER_NONE || filebrowser_get_type() == FILEBROWSER_SCAN_FILE || filebrowser_get_type() == FILEBROWSER_SELECT_FILE) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index aa97852ba8c..be032c88c2c 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -6467,9 +6467,12 @@ static int action_ok_open_uwp_permission_settings(const char *path, static int action_ok_open_picker(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { -#if TARGET_OS_IOS +#ifdef IOS ios_show_file_sheet(); return 0; +#elif defined(OSX) && defined(HAVE_APPLE_STORE) + osx_show_file_sheet(); + return 0; #else char *new_path = NULL; int ret = generic_action_ok_displaylist_push( diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 232ced8a7f4..b386968eaaa 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -492,7 +492,7 @@ static int filebrowser_parse( MENU_ENUM_LABEL_NO_ITEMS, MENU_SETTING_NO_ITEM, 0, 0, NULL); -#ifdef IOS +#if defined(IOS) || (defined(OSX) && defined(HAVE_APPLE_STORE)) { /* Check if we're allowed to escape our sandbox */ struct string_list *str_list = string_list_new(); @@ -5154,7 +5154,7 @@ static unsigned menu_displaylist_parse_content_information( db_name, sizeof(db_path)); last = path_get_extension_mutable(db_path); - if (*last) + if (last && *last) { last[0] = '.'; last[1] = 'r'; diff --git a/ui/drivers/cocoa/apple_platform.h b/ui/drivers/cocoa/apple_platform.h index 86bb97ee19a..4128b396586 100644 --- a/ui/drivers/cocoa/apple_platform.h +++ b/ui/drivers/cocoa/apple_platform.h @@ -15,6 +15,10 @@ extern void ios_show_file_sheet(void); extern bool ios_running_on_ipad(void); #endif +#if TARGET_OS_OSX +extern void osx_show_file_sheet(void); +#endif + #ifdef __OBJC__ #import @@ -56,6 +60,7 @@ typedef enum apple_view_type * the displays should not sleep. */ - (bool)setDisableDisplaySleep:(bool)disable; +- (void)openDocument:(id)sender; @end #endif diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index 20569fa7093..7656c90ea06 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -802,6 +802,13 @@ void ios_show_file_sheet(void) } #endif +#if TARGET_OS_OSX && defined(HAVE_APPLE_STORE) +void osx_show_file_sheet(void) +{ + [apple_platform openDocument:nil]; +} +#endif + void *cocoa_screen_get_chosen(void) { unsigned monitor_index; diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index c40c4588571..8da4b662457 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -918,16 +918,23 @@ static void open_document_handler( if (!result) return; - path_set(RARCH_PATH_CONTENT, state->result); - - if (core_name) + if (filebrowser_get_type() == FILEBROWSER_SCAN_FILE) + action_scan_file(state->result, NULL, 0, 0); + else { - content_ctx_info_t content_info = {0}; - task_push_load_content_with_current_core_from_companion_ui( - NULL, - &content_info, - CORE_TYPE_PLAIN, - NULL, NULL); + path_set(RARCH_PATH_CONTENT, state->result); + + if (!string_is_empty(core_name)) + { + content_ctx_info_t content_info = {0}; + task_push_load_content_with_current_core_from_companion_ui( + NULL, + &content_info, + CORE_TYPE_PLAIN, + NULL, NULL); + } + else + cocoa_file_load_with_detect_core(state->result); } }