File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed
Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ elseif(APPLE)
2727 find_library (COCOA_LIB Cocoa REQUIRED)
2828 find_library (WEBKIT_LIB WebKit REQUIRED)
2929 find_library (QUARTZCORE_LIB QuartzCore REQUIRED)
30- set (LIBS nlohmann_json::nlohmann_json ${COCOA_LIB} ${WEBKIT_LIB} ${QUARTZCORE_LIB} CURL::libcurl)
30+ find_library (UNIFORMTYPEIDENTIFIERS_FRAMEWORK UniformTypeIdentifiers REQUIRED)
31+ set (LIBS nlohmann_json::nlohmann_json ${COCOA_LIB} ${WEBKIT_LIB} ${QUARTZCORE_LIB} ${UNIFORMTYPEIDENTIFIERS_FRAMEWORK} CURL::libcurl)
3132elseif (EMSCRIPTEN)
3233 set (LIBS nlohmann_json::nlohmann_json)
3334endif ()
Original file line number Diff line number Diff line change 11#include " webview_candidate_window.hpp"
22#include < QuartzCore/QuartzCore.h>
3+ #include < UniformTypeIdentifiers/UniformTypeIdentifiers.h>
34#include < WebKit/WKWebView.h>
45
56NSString *const F5mErrorDomain = @" F5mErrorDomain" ;
@@ -125,18 +126,11 @@ - (void)webView:(WKWebView *)webView
125126
126127- (NSString *)mimeTypeForPath : (NSString *)path {
127128 NSString *pathExtension = [path pathExtension ];
128- CFStringRef type = UTTypeCreatePreferredIdentifierForTag (
129- kUTTagClassFilenameExtension , (__bridge CFStringRef)pathExtension,
130- NULL );
129+ UTType *type = [UTType typeWithFilenameExtension: pathExtension];
131130 NSString *mimeType = @" application/octet-stream" ;
132- if (!type)
133- return mimeType;
134- CFStringRef mimeTypeRef =
135- UTTypeCopyPreferredTagWithClass (type, kUTTagClassMIMEType );
136- if (mimeTypeRef) {
137- mimeType = (NSString *)mimeTypeRef;
131+ if (type && type.preferredMIMEType ) {
132+ mimeType = type.preferredMIMEType ;
138133 }
139- CFRelease (type);
140134 return mimeType;
141135}
142136
You can’t perform that action at this time.
0 commit comments