gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDirectoryEnumerator


From: Enrico Sersale
Subject: Re: NSDirectoryEnumerator
Date: Fri, 01 Oct 2004 15:39:55 +0300

On 2004-09-30 21:42:44 +0300 Enrico Sersale <address@hidden> wrote:


Today, only to test how much time this keeps, I've tryed to create a NSArray with all the directories on my disk.
The code is very simple, something like this:

  NSMutableArray *paths = [NSMutableArray array];
  NSDirectoryEnumerator *enumerator = [fm enumeratorAtPath: @"/"];
  NSString *path;

  while ((path = [enumerator nextObject])) {
    if ([[enumerator fileAttributes] fileType] == NSFileTypeDirectory) {
      [paths addObject: path];
    }
  }

Then I save the array in a file;

But I'm noticing that many, many directories are missing; for example, in /usr, I get only two entries, /usr/bin and /usr/lib; all the other are missing.
Can somebody test this?

I understand that this can look a naive question, but I'm not stupid. I'm *sure* that 
there is a bug somewere. Now I've built on my mac two tools with exactly this code; the 
first of them with Xcode, the other one with GNUstep (gnu-gnu-gnu). The output of the 
first tool is about the same of "find / -type d", while the second tool doesn't 
exit from the while loop; when it arrives to the last found object, it restarts from the 
beginning.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]