I know how to recursively list directory contents. I will be using Snow Leopard’s enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: method to do this.
However I want to store my findings into a object hierarchy (of, say, objects of a custom FileOrDirectory class that has isLeaf, children, and count attributes).
I need to pre-load the directory and file structure into such a object hierarchy, in order to do whatever I want with NSTreeController and whatnot. I guess the trickiest thing here is to get the children attribute correct in the object hierarchy.
Any ideas?
If I understand your question correctly, you could solve this by writing a recursive function that takes the current node (a file or a folder) and returns an object representing it’s structure.
This is Java, but maybe it conveys my idea. I have omitted
isLeafandcount, as their values can be derived from thechildren.