• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Issues in specifying the file extensions for NSOpenPanel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Issues in specifying the file extensions for NSOpenPanel
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Catching errors with MPMoviePlayerController
  • Next by Date: Pause during drawing
  • Previous by thread: Re: Catching errors with MPMoviePlayerController
  • Next by thread: Re: Issues in specifying the file extensions for NSOpenPanel
  • Index(es):
    • Date
    • Thread