Cocoa apis reports incorrect free space values, what should I use?

Does anyone know what Apple apis uses for this. Get the info panel to determine the free space in Lion? All the code I tried to get with the same available space reported by Apple fails, even Quick Look does not display the same space that is displayed in the Info view. This happens if I delete a bunch of files and try to read the available space.

Incorrect free space on Lion

When I use NSFileManager -> NSFileSystemFreeSize, I get 42918273024 bytes

When I use NSURL -> NSURLVolumeAvailableCapacityKey, I get 42918273024 bytes

When I use statfs -> buffer.f_bsize * buffer.f_bfree, I get 43180417024 bytes

statfs gets similar results for Quick Look, but how do I fit Get Info?

+5
source share
2 answers

You are probably seeing the result of local snapshots of Time Machine snapshots. The following quotes are from the following Apple support article, OS X Lion: About local Time Machine snapshots on Mac laptops :

Time Machine OS X Lion , "local ", , , . ( Time Capsule), " " , , , Time Capsule .

, :

.. Disk Utility, Finder Get Info. . Finder , .

, , , , , , Time Machine. , , df, Time Machine.

+1

, api, unix df -H , " ", .

df , , , . -H 10.

, : Cocoa

, df, , , .

0

All Articles