> On 4 Apr 2015, at 17:21, Ken Thomases <k...@codeweavers.com> wrote:
> 
> On Apr 4, 2015, at 4:23 AM, Gerriet M. Denkmann <gerr...@mdenkmann.de> wrote:
> 
>> When I look at " /Library/Dictionaries/Apple 
>> Dictionary.dictionary/Contents/Info.plist" in Finder, it shows a preview and 
>> says 5 kB. Ok.
>> 
>> But: Finder → FIle → Get Info says:
>> 4,893 bytes (Zero bytes on disk)
>> 
>> And lstat shows: 
>> st_size      = 4893  (file size, in bytes)
>> st_blocks    = 0             (blocks allocated for file)
>> st_flags     = 0x20  (user defined flags for file) 
>> 
>> /usr/include/sys/stat.h has:
>> #define UF_COMPRESSED        0x00000020      /* file is hfs-compressed */
>> 
>> So: where are these bytes (if not on disk)?
>> And if they are really compressed: how much space they take in some unknown 
>> compressed location?
>> 
>> I am trying to find who or what is taking space on my disk. So given some 
>> directory, I want to add the disk space of all its files (+ subdirectories).
> 
> In this case, the compressed data was probably small enough to store it in 
> the file metadata.  So, there really are no blocks allocated for the file's 
> data.

There are no blocks allocated as data, but the size of the Attributes B-tree 
will increase nevertheless.
My Attributes B-tree has about 1 GB  - so nothing to disregard.

> 
> Do some web searching for "hfs compression" to learn more.
> 
> As far as how you should write a program to compute the space used on disk, I 
> recommend that you trust NSURLTotalFileAllocatedSizeKey.

I just created an empty file and added lots of extended attributes. Some ≤ 3202 
bytes (which are stored inside the Attributes B-tree as kHFSPlusAttrInlineData) 
some larger than this (kHFSPlusAttrForkData).

But NSURLTotalFileAllocatedSizeKey (which is documented as "This includes the 
size of any file metadata.") remains 0.

Kind regards,

Gerriet.


_______________________________________________

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

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

Reply via email to