|
@@ -158,7 +158,14 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
|
|
|
[dialog setAllowsOtherFileTypes:YES];
|
|
|
|
|
|
if (default_location) {
|
|
|
- [dialog setDirectoryURL:[NSURL fileURLWithPath:[NSString stringWithUTF8String:default_location]]];
|
|
|
+ char last = default_location[SDL_strlen(default_location) - 1];
|
|
|
+ NSURL* url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:default_location]];
|
|
|
+ if (last == '/') {
|
|
|
+ [dialog setDirectoryURL:url];
|
|
|
+ } else {
|
|
|
+ [dialog setDirectoryURL:[url URLByDeletingLastPathComponent]];
|
|
|
+ [dialog setNameFieldStringValue:[url lastPathComponent]];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
NSWindow *w = NULL;
|