Re: alternate file extension
Re: alternate file extension
- Subject: Re: alternate file extension
- From: "Jacob Eggers" <email@hidden>
- Date: Tue, 20 Feb 2007 15:50:33 -0500
Is there a good tutorial somewhere on how to use searchlight? Or could
someone post code on how to search NSString* directory; for files of UTI
type "public.image"?
I know how to use NSBundle to find files, but don't have the first clue on
how to use searchlight.
thanks,
j
On 2/19/07, Scott Anguish <email@hidden> wrote:
On Feb 19, 2007, at 5:39 PM, Jacob Eggers wrote:
> Okay, so this is a simple question, I want to get an NSArray with
> all of the
> images in a particular directory.
>
> I could do something like this:
> [bundle pathsForResourcesOfType: @"jpg" inDirectory: dir];
>
> But, then I'm missing extensions of gif, tiff.. not to mention jpeg,
> JPG
> Jpeg....
>
> Is there an easy way to handle this, or should I just write a custom
> NSBundle class with the many appropriate checks?
Use the NSImage class method imageFileTypes to get an array of
file
types that are supported for loading
iterate over that list calling
pathsForResourcesOfType:inDirectory:
for each one.
you'll only get the types you can read, but you'll also be able to
load types that use services for conversion.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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