0

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.

rpatters1
  • 382
  • 1
  • 11
  • Just adding a data point, I have an NSDocument-based app which also has several other save panels for image export etc. None of my save panels exhibit the behavior described here on Catalina, with or without extensions shown in Finder, with or without multiple file types / allowsOtherFileTypes = true. I'm seeing selection of just the file stem, not the extension, consistently. The only differences I detect from your code are 1) I'm always running panel as sheet on parent window, 2) my code is Swift (which shouldn't matter). – Corbell Jul 04 '20 at 21:29
  • FWIW: the title of the dialog has returned in Catalina, having been awol (it seems) from 10.11 - 10.14. So that means someone at Apple touched the NSSavePanel code. – rpatters1 Jul 05 '20 at 13:13

0 Answers0