diff options
| author | Manolo Gouy <Manolo> | 2017-11-22 12:42:42 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-11-22 12:42:42 +0000 |
| commit | 02d58597e90088d4116e23acc8be1c0f04c8f19c (patch) | |
| tree | e7b901e37162e733f76e04013e486e20a6fc9fe6 /src | |
| parent | 310c545179793cdb59dba73ce5080c1ebd62f0b1 (diff) | |
MacOS native file chooser: STR#3406 continued - restore broken filename preset in save dialog.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12569 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Native_File_Chooser_MAC.mm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Fl_Native_File_Chooser_MAC.mm b/src/Fl_Native_File_Chooser_MAC.mm index fa69d9ff2..2b366b249 100644 --- a/src/Fl_Native_File_Chooser_MAC.mm +++ b/src/Fl_Native_File_Chooser_MAC.mm @@ -602,14 +602,18 @@ int Fl_Quartz_Native_File_Chooser_Driver::runmodal() } if (_directory && !dir) dir = [[NSString alloc] initWithUTF8String:_directory]; if (fl_mac_os_version >= 100600) { - if (dir && fname) { + bool usepath = false; + NSString *path = nil; + if (dir && fname && [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]]) { // STR #3406: If both dir + fname specified, combine and pass to setDirectoryURL - NSString *path = [[NSString alloc] initWithFormat:@"%@/%@", dir, fname]; // dir+fname -> path + path = [[NSString alloc] initWithFormat:@"%@/%@", dir, fname]; // dir+fname -> path // See if full path to file exists // If dir exists but fname doesn't, avoid using setDirectoryURL, // otherwise NSSavePanel falls back to showing user's Documents dir. // - if ( [[NSFileManager defaultManager] fileExistsAtPath:path] ) { + if ( [[NSFileManager defaultManager] fileExistsAtPath:path] ) usepath = true; + } + if (usepath) { // Set only if full path exists [(NSSavePanel*)_panel performSelector:@selector(setDirectoryURL:) withObject:[NSURL fileURLWithPath:path]]; } else { // didn't setDirectoryURL to full path? Set dir + fname separately.. @@ -617,7 +621,6 @@ int Fl_Quartz_Native_File_Chooser_Driver::runmodal() if (fname) [(NSSavePanel*)_panel performSelector:@selector(setNameFieldStringValue:) withObject:fname]; } [path release]; - } retval = [(NSSavePanel*)_panel runModal]; } else { |
