diff -r 77b09bb52ca0 -r 794a5c91c479 ui/cocoa/window.m --- a/ui/cocoa/window.m Sat Apr 05 18:41:30 2014 +0200 +++ b/ui/cocoa/window.m Sun Apr 06 13:21:37 2014 +0200 @@ -27,6 +27,8 @@ */ #include +#include +#include #import "window.h" #import "menu.h" @@ -190,3 +192,26 @@ return obj; } + +char* ui_openfiledialog(UiObject *obj) { + NSOpenPanel* op = [NSOpenPanel openPanel]; + if ([op runModal] == NSOKButton) { + NSArray *urls = [op URLs]; + NSURL *url = [urls objectAtIndex:0]; + + const char *str = [[url path] UTF8String]; + return (char*)strdup(str); + } + return NULL; +} + +char* ui_savefiledialog(UiObject *obj) { + NSSavePanel* sp = [NSSavePanel savePanel]; + if ([sp runModal] == NSOKButton) { + NSURL *url = [sp URL]; + + const char *str = [[url path] UTF8String]; + return (char*)strdup(str); + } + return NULL; +}