diff --git a/OpenDialog/cocoa.m b/OpenDialog/cocoa.m index aeeb98aa..cfb2553a 100644 --- a/OpenDialog/cocoa.m +++ b/OpenDialog/cocoa.m @@ -5,6 +5,8 @@ char *do_open_rom_dialog(void) { @autoreleasepool { + int stderr_fd = dup(STDERR_FILENO); + close(STDERR_FILENO); NSWindow *key = [NSApp keyWindow]; NSOpenPanel *dialog = [NSOpenPanel openPanel]; dialog.title = @"Open ROM"; @@ -12,6 +14,7 @@ char *do_open_rom_dialog(void) [dialog runModal]; [key makeKeyAndOrderFront:nil]; NSString *ret = [[[dialog URLs] firstObject] path]; + dup2(stderr_fd, STDERR_FILENO); if (ret) { return strdup(ret.UTF8String); } @@ -22,6 +25,8 @@ char *do_open_rom_dialog(void) char *do_open_folder_dialog(void) { @autoreleasepool { + int stderr_fd = dup(STDERR_FILENO); + close(STDERR_FILENO); NSWindow *key = [NSApp keyWindow]; NSOpenPanel *dialog = [NSOpenPanel openPanel]; dialog.title = @"Select Boot ROMs Folder"; @@ -30,6 +35,7 @@ char *do_open_folder_dialog(void) [dialog runModal]; [key makeKeyAndOrderFront:nil]; NSString *ret = [[[dialog URLs] firstObject] path]; + dup2(stderr_fd, STDERR_FILENO); if (ret) { return strdup(ret.UTF8String); }