views:

33

answers:

1

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?

+3  A: 

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:.

Joshua Nozzi
Unfortuantely this doesn't forbid to choose files. Cocoa is sometimes so f**** restricted.
Lothar
The problem isn't with Cocoa. To be blunt: you're completely ignoring the documentation, which is where the restriction comes in (you're restricting yourself). A quick look at the NSOpenPanel reference reveals -setCanChooseFiles:, which seems to solve your remaining problem.
Joshua Nozzi