Re: Number of Files on Volume
Re: Number of Files on Volume
- Subject: Re: Number of Files on Volume
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 26 Nov 2008 16:19:33 +0100
Only the HIToolbox will be discontinued. All others API are already
available in 64 bits app.
IMHO Apple is neither going to remove the CoreServices File Manager
nor even mark it deprecated (before at least Mac OS 11 or 12).
There is no Cocoa API to efficiently access the File System.
And if you want do not want to use the File Manager, you will have to
use the Darwin way, which is far more complex (and use under the hood
by the File Manager).
Have a look at getattrlist() and the ATTR_VOL_FILECOUNT attribute (the
man page provide a sample that show how to retreive the file count).
Le 26 nov. 08 à 15:53, Joe Turner a écrit :
I'm just worried that it will be deprecated soon with the release of
Snow Leopard; it is Carbon.
Second, I just wanted to see if there was an easy Cocoa way; the
CoreServices way works fine.
On Nov 26, 2008, at 8:51 AM, Jean-Daniel Dupas wrote:
Just a question, what was wrong with the CoreServices way ? (ie
using FSGetVolumeInfo).
Le 26 nov. 08 à 15:19, Joe Turner a écrit :
Okay, maybe I spoke too soon... It worked twice. To get the number
of files, I am doing this now:
- (NSNumber *)fileCount
{
NSDictionary *attributes = [[NSFileManager defaultManager]
fileSystemAttributesAtPath:path];
return [NSNumber numberWithDouble:
([[attributes objectForKey:NSFileSystemNodes]
doubleValue] - [[attributes objectForKey:NSFileSystemFreeNodes]
doubleValue])];
}
The first two times I got the right number (752339), but now I am
getting 18749375. Is this way even supposed to work?
Thanks!
_______________________________________________
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