How can i use NSSavePanel to select a directory?

Lothar picture Lothar · Aug 3, 2010 · Viewed 7.5k times · Source

I need the user select an existing or a new directory where my app can save a few files.

Can i do this with NSSavePanel or is there another directory selector class?

Answer

Joshua Nozzi picture Joshua Nozzi · Aug 3, 2010

NSSavePanel doesn't give the ability to choose folders but NSOpenPanel (a subclass of NSSavePanel) does. You set YES for -setCanChooseDirectories: and -setCanCreateDirectories:, set a prompt that makes sense with -setPrompt:.