diff --git a/cocoa/dlg.m b/cocoa/dlg.m index f29448e..a6c47f2 100644 --- a/cocoa/dlg.m +++ b/cocoa/dlg.m @@ -1,4 +1,5 @@ #import +#import #include "dlg.h" void* NSStr(void* buf, int len) { @@ -93,7 +94,15 @@ - (NSInteger)runPanel:(NSSavePanel*)panel { [panel setTitle:[[NSString alloc] initWithUTF8String:self->params->title]]; } if(self->params->numext > 0) { - [panel setAllowedFileTypes:[NSArray arrayWithObjects:(NSString**)self->params->exts count:self->params->numext]]; + NSString** exts = (NSString**)self->params->exts; + NSMutableArray *types = [NSMutableArray array]; + + for (int i=0; iparams->numext; i++) { + NSString* ext = exts[i]; + UTType *t = [UTType typeWithFilenameExtension: exts[i]]; + [types addObject: t]; + } + [panel setAllowedContentTypes:types]; } if(self->params->relaxext) { [panel setAllowsOtherFileTypes:YES]; diff --git a/cocoa/dlg_darwin.go b/cocoa/dlg_darwin.go index f59dd20..c3356a4 100644 --- a/cocoa/dlg_darwin.go +++ b/cocoa/dlg_darwin.go @@ -1,6 +1,6 @@ package cocoa -// #cgo darwin LDFLAGS: -framework Cocoa +// #cgo darwin LDFLAGS: -framework Cocoa -framework UniformTypeIdentifiers // #include // #include // #include "dlg.h"