From bbf858e6ab01ebdb486e54e947b71d52fd258537 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 27 Jan 2022 00:07:17 +1100 Subject: [PATCH] Cocoa: Fixe open file dialog not filtering files in executable compiled by buildbot --- src/interop_cocoa.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/interop_cocoa.m b/src/interop_cocoa.m index cf340d4e2..33f17aed3 100644 --- a/src/interop_cocoa.m +++ b/src/interop_cocoa.m @@ -523,8 +523,11 @@ cc_result Window_OpenFileDialog(const char* const* filters, OpenFileDialogCallba } [dlg setCanChooseFiles: YES]; - [dlg setAllowedFileTypes:types]; - if ([dlg runModal] != NSOKButton) return 0; + if ([dlg runModalForTypes:types] != NSOKButton) return 0; + // unfortunately below code doesn't work when linked against SDK < 10.6 + // https://developer.apple.com/documentation/appkit/nssavepanel/1534419-allowedfiletypes + // [dlg setAllowedFileTypes:types]; + // if ([dlg runModal] != NSOKButton) return 0; files = [dlg URLs]; if ([files count] < 1) return 0;