To make things easier for your users, try using the Open Panel the following way. This limits them to choose one directory (instead of both the files):
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:YES];
[panel setCanChooseFiles:NO];
[panel setAllowsMultipleSelection:NO];
// don't set anything with setAllowedFileTypes:
You will then receive zero or one URL back (depending if user pressed OK or cancel) which points to the directory. Then use this URL together with a NSDirectoryEnumerator
or something similar provided by NSFileManager to get the files inside the directory.
Also make sure you run the panel in an appropriate (not deprecated) manner using one of the following methods:
– beginSheetModalForWindow:completionHandler:
– beginWithCompletionHandler:
– runModal