Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa Sandbox: How to get permission to write multiple files or to a directory with NSSavePanel

So the NSSavePanel currently returns a file url complete with extension, and your app has permission to write to that file.

Is there any way to allow the user to select a directory to write to? For example, if the app is exporting a dozen images at once, the names won't be specified by the user in advance.

like image 237
SG1 Avatar asked Aug 28 '12 22:08

SG1


1 Answers

You need NSOpenPanel.

NSOpenPanel * openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles:NO];
[openPanel setCanChooseDirectories:YES];
[openPanel setAllowsMultipleSelection:NO];
like image 103
dinosaur Avatar answered Sep 18 '22 04:09

dinosaur