Re: Calculating file size
Re: Calculating file size
- Subject: Re: Calculating file size
- From: Chris Suter <email@hidden>
- Date: Tue, 29 Apr 2008 10:05:13 +1000
On 29/04/2008, at 2:58 AM, Aaron Burghardt wrote:
When I learned of it, roughly in the timeframe of Jaguar or Panther,
there was a document with a title like "Mac OS X System Overview",
or something similar--I think that it where I read about it. I'm
sure it was documented in somewhere in Apple's developer
documentation, but it apparently it has been removed.
Given the current lack of documentation, I agree with Jean-Daniel
Dupas that I would avoid it unless actually required.
I personally wouldn't be too worried about using it. There are enough
references around to suggest that it's here to stay and whilst it's
not definitive, the kernel sources don't have comments to suggest that
it's going to be deprecated like "<file>/rsrc" is. If they did
deprecate it they'd have the issue of dealing with other file-systems
that might be using that pattern (for example NTFS implementations
might use it to access named streams). I guess if you wanted to be
sure, you could contact DTS.
Going back to the original question, there's another API that's worth
considering that I don't think has been mentioned: getattrlist.
ATTR_FILE_TOTALSIZE will give you the total number of bytes used by
all of the file's forks. ATTR_FILE_ALLOCSIZE will give you the
physical size (which includes the spare space used for padding). I'm
not sure what the application of this information is for, but if it's
for seeing if files will fit somewhere, it's a bit difficult to get an
exact figure because there's the additional space that might be
required in metadata files so care should be taken with how this
information is used.
- Chris
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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