Re: NSFileManager: no way to check a file meets a set of file types??
Re: NSFileManager: no way to check a file meets a set of file types??
- Subject: Re: NSFileManager: no way to check a file meets a set of file types??
- From: Stephane Sudre <email@hidden>
- Date: Fri, 29 Jun 2007 00:11:59 +0200
On jeudi, juin 28, 2007, at 11:33 PM, Brian Smith wrote:
On Jun 28, 2007, at 2:56 PM, Stephane Sudre wrote:
When you need to filter out some file types in a NSOpenPanel, you can
use the various fileTypes message of NSImage, QTMovie
So it seems strange to me that there is not a message in
NSFileManager to check that a file at a filePath matches one of the
fileTypes.
ex:
- (BOOL) fileMatchesTypes:(NSArray *) fileTypes;
No I don't think it has this but you can get a NSDictionary of the
file attributes at a file path with fileAttributesAtPath:traverseLink:
and use the NSFileManager's fileType category addition to it to get
the file type, which you can then compare to your file types.
Am I missing something or is it a job for Bug Reporter (Enhancement
Request)?
Might be worth it but in the mean time you write your own category to
NSFileManager. I would use method signiture more like -
(BOOL)fileAtPath:(NSString *)path matchesTypes:(NSArray *)fileTypes.
That's what I did (though I like your method name better than mine).
I will file an enhancement request.
_______________________________________________
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