I do some manual directory sizing in my application, so I'm interested in using the new fast directory sizing capabilities on APFS volumes. The documentation currently says the following:
"The file system can enable fast directory sizing on empty directories. You cannot enable Fast Directory Sizing on directories containing files or other directories directly; you must instead first create a new directory, enable fast directory sizing on it, and then move the contents of the existing directory to the new directory."
My questions about this are:
- Is there any API that can tell me whether or not a given directory currently has fast directory sizing enabled for it? For directories that don't have it enabled, I would want to fall back to manually calculating the size in that case.
- Assuming I can tell fast directory sizing is enabled, what is the API for actually retrieving the calculated size? Can you just look at the value returned for the NSFileSize key after retrieving file attributes with NSFileManager? Or is there some new API for this?