mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-04 14:49:40 +00:00
dialog: fix default file name on Cocoa
This commit is contained in:
committed by
Ryan C. Gordon
parent
fc19ae343c
commit
b2d152e51f
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user