• 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
Re: Issues in specifying the file extensions for NSOpenPanel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues in specifying the file extensions for NSOpenPanel


  • Subject: Re: Issues in specifying the file extensions for NSOpenPanel
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 9 Nov 2010 21:13:18 -0800

On Nov 9, 2010, at 07:00, Sachin Porwal wrote:

> 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 ?

Presumably, since this is mature API, it's behaving as designed. You can get the behavior you want by using a panel delegate to disable choosing directories.

However, a better choice might be specify your desired files by UTI rather than extension. ('kUTTypeDiskImage' is the UTI for disk images.) You simply pass the UTI in place of the extension. That should work without a panel delegate.

Note also that 'runModalForDirectory:...' is deprecated in 10.6. The correct way is to use 'setAllowedFileTypes:' and 'runModal:'.


_______________________________________________

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: Corbin Dunn <email@hidden>
References: 
 >Issues in specifying the file extensions for NSOpenPanel (From: Sachin Porwal <email@hidden>)

  • Prev by Date: Re: Problem with redirecting stdout
  • Next by Date: Cocoaheads Lake Forest meets tomorrow, 11/10 at 7pm
  • Previous by thread: Issues in specifying the file extensions for NSOpenPanel
  • Next by thread: Re: Issues in specifying the file extensions for NSOpenPanel
  • Index(es):
    • Date
    • Thread