On 19 Aug 2009, at 09:03, Charles Srstka wrote:

On Aug 19, 2009, at 2:59 AM, Jean-Daniel Dupas wrote:

I think you have to add data and resource sizes to match the Finder behavior (which are two distinct field in the catalog info).

Ah, you're right. This probably makes Carbon's file manager the most convenient way to do it (I believe it's also the best performing).

As I think I may have mentioned before, contrary to apparently widespread opinion, Carbon isn't magic. The Carbon file manager APIs are based on BSD APIs, and calling the BSD APIs in question is going to be faster if you really need high performance because they don't have to map things to the Carbon API's data structures and back again.

*However*, Carbon is often a good choice because you don't have to worry about whether the filesystem supports getattrlist(), searchfs(), getdirentriesattr() et al.

In this particular instance though, while the attraction of FSGetCatalogInfoBulk() is obvious, I worry that it'd be easy to mess up when implementing recursive directory traversal. It might be better to use fts() with the FTS_NOSTAT option and then call getattrlist().

However, if you use another method, you can still get the resource fork size by appending /..namedfork/rsrc to the end of the path for each regular file.

Or by using getattrlist() or getdirentriesattr() with ATTR_FILE_DATALENGTH and ATTR_FILE_RSRCLENGTH (or ATTR_FILE_DATAALLOCSIZE and ATTR_FILE_RSRCALLOCSIZE if that's what you want), remembering of course that not all filesystems necessarily support those APIs. If a volume doesn't support getattrlist(), it's very unlikely to have any kind of resource for support.

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to