• 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: NSFileManager: no way to check a file meets a set of file types??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Chris Parker <email@hidden>
  • Date: Thu, 28 Jun 2007 15:44:22 -0700


On Jun 28, 2007, at 3:11 PM, Stephane Sudre wrote:


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 NSIma鶐ᓇ, 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.

I'm looking forward to the enhancement request, but fileAtPath:matchesTypes: is something we might actually implement, and then we'd both have a problem.


Namespacing your selector via a prefix would also be a good idea; that way any future Foundation implementation won't stomp on yours if we happen to pick the same mellifluous name.

.chris

--
Chris Parker
Cocoa Frameworks
Apple, Inc.


_______________________________________________

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


References: 
 >Re: NSFileManager: no way to check a file meets a set of file types?? (From: Stephane Sudre <email@hidden>)

  • Prev by Date: Trouble with static linking
  • Next by Date: Re: Trouble with static linking
  • Previous by thread: Re: NSFileManager: no way to check a file meets a set of file types??
  • Next by thread: Trouble with static linking
  • Index(es):
    • Date
    • Thread