Re: Directory Enumeration in Cocoa
Re: Directory Enumeration in Cocoa
- Subject: Re: Directory Enumeration in Cocoa
- From: Chris Parker <email@hidden>
- Date: Fri, 18 Oct 2002 15:32:01 -0700
On Friday, October 18, 2002, at 03:18 PM, Rosyna wrote:
I wrote an app a while back that tests iteration speeds of different
methods and counts the files resulting from it. When doing the BSD and
Carbon iteration for a directory, it returns 38735 files. When I do
the Cocoa enumeration I get 38710 files.
What is causing the cocoa enumeration to show 25 less files? Did I
miss something?
int count=0;
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager]
enumeratorAtPath:@"/Applications/"];
while (file = [enumerator nextObject])
{
BOOL isDirectory=NO;
[[NSFileManager defaultManager] fileExistsAtPath:[NSString
stringWithFormat:@"%@/%@",@"/Applications",file]
isDirectory:&isDirectory];
if (!isDirectory)
count++;
}
That's odd...
Was this on a local volume or on a network/UFS volume? If the latter,
I'm surprised that the BSD and Carbon iterations would have the
identical count, as the BSD iteration will pick up ._ files, while the
Carbon one will not.
I'd be interested to know what the filenames in the target directory
looked like - if you don't feel comfortable posting them to the list,
please send them to me directly.
.chris
--
Chris Parker
Cocoa Frameworks Engineer
Apple Computer, Inc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.