Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scaning folder for file with particular extension....



On Jan 26, 2005, at 4:51 AM, David Niemeijer wrote:
At 6:18 -0500 26/1/05, Laurence Harris wrote:
Use FSGetCatalogInfoBulk to iterate a single folder and use
LSCopyItemInfoForRef() to get the extension of each file returned.

Would using LSCopyItemInfoForRef be faster or slower than determining the extension from the:


1) the filename supplied in the file name array FSGetCatalogInfoBulk can supply

2) getting the file name with a call to FSGetCatalogInfo

It seems to me that LSCopyItemInfoForRef may just be a high-level function calling FSGetCatalogInfo and then converting the filename to a CFString and removing anything but the extension. Also, would it do anything more advanced than just taking the right most characters from the filename up to the first period?

If you have a lot of files to plough through this kind of things may make a difference

Yes, LSCopyItemInfoForRef will do I/O. What you probably want to use instead is FSGetCatalogInfoBulk in conjunction with LSGetExtensionInfo. LSGetExtensionInfo is a very fast function which locates the first character of the extension in a UniChar buffer (i.e., the HFSUniStr255 filled by FSGetCatalogInfoBulk).


-Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Scaning folder for file with particular extension.... (From: Laurence Harris <email@hidden>)
 >Re: Scaning folder for file with particular extension.... (From: David Niemeijer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.