Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
app: fix macOS file picker to support Uniform Type Identifiers (#12965)
Vincent Koc4111db013f64
diff --git a/app/dialog/cocoa/dlg.m b/app/dialog/cocoa/dlg.mindex 7ee22a0d4..e90098e74 100644--- a/app/dialog/cocoa/dlg.m+++ b/app/dialog/cocoa/dlg.m@@ -3,6 +3,11 @@#include <string.h>#include <sys/syslimits.h>+// Import UniformTypeIdentifiers for macOS 11++#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>+#endif+void* NSStr(void* buf, int len) {return (void*)[[NSString alloc] initWithBytes:buf length:len encoding:NSUTF8StringEncoding];}@@ -109,12 +114,20 @@ DlgResult fileDlg(FileDlgParams* params) {if(self->params->title != nil) {[panel setTitle:[[NSString alloc] initWithUTF8String:self->params->title]];}-#pragma clang diagnostic push-#pragma clang diagnostic ignored "-Wdeprecated-declarations"+ // Use modern allowedContentTypes API for better file type support (especially video files)if(self->params->numext > 0) {- [panel setAllowedFileTypes:[NSArray arrayWithObjects:(NSString**)self->params->exts count:self->params->numext]];+ NSMutableArray *utTypes = [NSMutableArray arrayWithCapacity:self->params->numext];+ NSString** exts = (NSString**)self->params->exts;+ for(int i = 0; i < self->params->numext; i++) {+ UTType *type = [UTType typeWithFilenameExtension:exts[i]];+ if(type) {+ [utTypes addObject:type];+ }+ }+ if([utTypes count] > 0) {+ [panel setAllowedContentTypes:utTypes];+ }}-#pragma clang diagnostic popif(self->params->relaxext) {[panel setAllowsOtherFileTypes:YES];}diff --git a/app/dialog/cocoa/dlg_darwin.go b/app/dialog/cocoa/dlg_darwin.goindex a71275cf0..6bfae5a1a 100644--- a/app/dialog/cocoa/dlg_darwin.go+++ b/app/dialog/cocoa/dlg_darwin.go@@ -1,6 +1,6 @@package cocoa-// #cgo darwin LDFLAGS: -framework Cocoa+// #cgo darwin LDFLAGS: -framework Cocoa -framework UniformTypeIdentifiers// #include <stdlib.h>// #include <sys/syslimits.h>// #include "dlg.h"