Skip to content

Commit

Permalink
Fix warnings in hs.dialog
Browse files Browse the repository at this point in the history
- Replaced `setAllowedFileTypes` with `setAllowedContentTypes`.
  • Loading branch information
latenitefilms committed Dec 28, 2023
1 parent 56b5835 commit 353c7a7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions extensions/dialog/libdialog.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@import Cocoa ;
@import LuaSkin ;

#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>

#define NO_INTENTS
#import "MJAppDelegate.h"
#undef NO_INTENTS
Expand Down Expand Up @@ -355,16 +357,17 @@ static int chooseFileOrFolder(lua_State *L) {
NSOpenPanel *panel = [NSOpenPanel openPanel];

// Allowed File Types:
NSMutableArray *allowedFileTypes;
NSMutableArray *allowedContentTypes;
if (lua_istable(L, 6)) {
allowedFileTypes = [[NSMutableArray alloc] init];
allowedContentTypes = [[NSMutableArray alloc] init];
lua_pushnil(L);
while (lua_next(L, 6) != 0) {
NSString *item = [NSString stringWithUTF8String:luaL_checkstring(L, -1)];
[allowedFileTypes addObject:item];
UTType *contentType = [UTType typeWithIdentifier:item];
[allowedContentTypes addObject:contentType];
lua_pop(L, 1);
}
[panel setAllowedFileTypes:allowedFileTypes];
[panel setAllowedContentTypes:allowedContentTypes];
}

// Message:
Expand Down

0 comments on commit 353c7a7

Please sign in to comment.