-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils_darwin.m
executable file
·31 lines (30 loc) · 1.09 KB
/
utils_darwin.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void internal_show_alert(string s) {
NSBeep();
NSString* ns_string = nsstring(s);
NSAlert* alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSWarningAlertStyle];
[alert setMessageText:ns_string];
[alert setInformativeText:@""];
[alert addButtonWithTitle:@"Ok"];
[alert runModal];
}
string internal_open_file() {
while(1) {
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
[openDlg setCanChooseFiles:YES];
[openDlg setTitle:@"Choose a Game Boy ROM"];
[openDlg setShowsResizeIndicator:YES];
[openDlg setShowsHiddenFiles:NO];
[openDlg setCanChooseFiles:YES];
[openDlg setCanChooseDirectories:NO];
[openDlg setAllowsMultipleSelection:NO];
[openDlg setAllowedFileTypes:@[@"gb",@"gbc"]];
if([openDlg runModal] == NSFileHandlingPanelOKButton) {
NSURL *selection = openDlg.URLs[0];
NSString* path = [[selection path] stringByResolvingSymlinksInPath];
return tos_clone(path.UTF8String);
} else {
return tos_clone(@"".UTF8String);
}
}
}