5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 01:13:03 +08:00

[mac] Fix for cancelling Dialogs. Fixes #1047

This commit is contained in:
Lea Anthony 2021-12-28 20:04:19 +11:00
parent 0571deb290
commit e2f3a11a33
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -540,6 +540,10 @@
// Setup callback handler
[dialog beginSheetModalForWindow:self.mainWindow completionHandler:^(NSModalResponse returnCode) {
if ( returnCode != NSModalResponseOK) {
processOpenFileDialogResponse("[]");
return;
}
NSMutableArray *arr = [NSMutableArray new];
for (NSURL *url in [dialog URLs]) {
[arr addObject:[url path]];
@ -592,10 +596,12 @@
// Setup callback handler
[dialog beginSheetModalForWindow:self.mainWindow completionHandler:^(NSModalResponse returnCode) {
NSURL *url = [dialog URL];
if ( url != nil ) {
processSaveFileDialogResponse([url.path UTF8String]);
return;
if ( returnCode == NSModalResponseOK ) {
NSURL *url = [dialog URL];
if ( url != nil ) {
processSaveFileDialogResponse([url.path UTF8String]);
return;
}
}
processSaveFileDialogResponse("");
}];