macos: fix some sandbox handling for app store (#17424)

* minor safety check

* macos: fix some sandbox handling for app store
This commit is contained in:
Eric Warmenhoven 2025-01-17 13:54:54 -05:00 committed by GitHub
parent dda78a4fc8
commit 2471082ced
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 36 additions and 14 deletions

View File

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

View File

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

View File

@ -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';

View File

@ -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 <Foundation/Foundation.h>
@ -56,6 +60,7 @@ typedef enum apple_view_type
* the displays should not sleep.
*/
- (bool)setDisableDisplaySleep:(bool)disable;
- (void)openDocument:(id)sender;
@end
#endif

View File

@ -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;

View File

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