Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings in hs.dialog #3575

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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