diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index 15dcfa1ba..1d10ebe74 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -428,8 +428,16 @@ void OpenDialog(struct Application *app, char *callbackID, char *title, char *fi // Valid but appears to do nothing.... :/ msg(dialog, s("setTitle:"), str(title)); - // TODO: Filters - // No filters: [dialog setAllowsOtherFileTypes:YES]; + // Filters + if( filter != NULL && strlen(filter) > 0) { + Debug("Using filter: %s", filter); + id filterString = msg(str(filter), s("stringByReplacingOccurrencesOfString:withString:"), str("*."), str("")); + filterString = msg(filterString, s("stringByReplacingOccurrencesOfString:withString:"), str(" "), str("")); + id filterList = msg(filterString, s("componentsSeparatedByString:"), str(",")); + msg(dialog, s("setAllowedFileTypes:"), filterList); + } else { + msg(dialog, s("setAllowsOtherFileTypes:"), YES); + } // Setup Options msg(dialog, s("setCanChooseFiles:"), allowFiles); diff --git a/v2/test/runtime/runtime.go b/v2/test/runtime/runtime.go index e52b4fe20..ed24fc3e9 100644 --- a/v2/test/runtime/runtime.go +++ b/v2/test/runtime/runtime.go @@ -111,8 +111,9 @@ func (r *RuntimeTest) OpenDialogMultiple(title string, filter string) []string { } // OpenDialogAllOptions will call the Runtime.Dialog.OpenDialog method allowing multiple selection -func (r *RuntimeTest) OpenDialogAllOptions() []string { +func (r *RuntimeTest) OpenDialogAllOptions(filter string) []string { dialogOptions := &options.OpenDialog{ + Filter: filter, AllowFiles: true, AllowDirectories: true, ShowHiddenFiles: true,