I always run macOS with the Finder options set to show extensions. I have some code that opens an NSSavePanel
. In macOS versions before Catalina, it opened with only the filename selected and not the extension. Starting in Catalina, the entire filename and extension are selected, which greatly slows down the user's workflow. (Or alternatively, less frequently, nothing is selected.)
Here is my code that opens NSSavePanel
. The variables preferredExtension
and defaultName
are const char *
. The default name does not include the extension.
NSSavePanel *sPanel = [NSSavePanel savePanel];
NSArray * arrayOfExtensions = [NSArray arrayWithObject:[NSString stringWithCString:preferredExtension encoding:NSUTF8StringEncoding]];
[sPanel setAllowedFileTypes:arrayOfExtensions];
[sPanel setAllowsOtherFileTypes:true];
[sPanel setNameFieldStringValue:[NSString stringWithCString:defaultName encoding:NSUTF8StringEncoding]];
NSInteger panelResult = [sPanel runModal];
I have seen some chatter about this on the Internet, especially regarding Adobe products. There does not appear to be a firm consensus on whether this is an Apple bug in Catalina or if there is some programming step I can take (or Finder option) so that it will only select the filename. Any help would be appreciated.