Re: Building a tree
Re: Building a tree
- Subject: Re: Building a tree
- From: Graham Cox <email@hidden>
- Date: Sun, 15 Nov 2009 12:17:03 +1100
On 12/11/2009, at 8:01 PM, Jonathan Guy wrote:
> I'm having a hard time finding a good example of this on the web so I thought I'd post here. I have an array of file system paths (NSStrings) and need to convert this into a tree structure using parent child tree node objects. The method has to be as efficient as possible as it will be crunching a lot of data. Any pointers to documentation or a good example would be much appreciated.
I make no claims for its efficiency, but I have public code that does exactly this:
http://apptree.net/gcfolderbrowser.htm
While I present it as a user interface controller, the code internally models the file system paths as a tree, and does so as lazily as possible - in other words it doesn't enumerate folders unless the user interface actually needs to display them, and then it caches the results when it does, so it's not hitting the disk any more than necessary.
--Graham
_______________________________________________
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