Issues in specifying the file extensions for NSOpenPanel
Issues in specifying the file extensions for NSOpenPanel
- Subject: Issues in specifying the file extensions for NSOpenPanel
- From: Sachin Porwal <email@hidden>
- Date: Tue, 9 Nov 2010 20:30:10 +0530
Hi All,
In my application I need to choose only dmg files, so I am using
NSOpenPanel with the following code snippet.
But the NSOpenPanel is also allowing me to choose the folders having
the extension '.dmg'.
Ideally NSOpenPanel should allow me to choose only dmg files not
folders ? Is this behavior as designed ?
----------------------
NSOpenPanel *op = [NSOpenPanel openPanel];
[op setCanChooseFiles:YES];
[op setCanChooseDirectories:NO];
NSInteger val = [op runModalForDirectory:@"/" file:nil
types:[NSArray arrayWithObject:@"dmg"]];
if( val == NSOKButton )
{
NSArray *filesToOpen = [op filenames];
NSLog(@"%@", filesToOpen );
}
----------------------
Please suggest the right way to disallow the folder selection in this
case such that the open button remains disable for all the folders.
Thanks,
Sachin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden