Monday, November 08, 2010 at 12:02 AM.


on visitFolder (path, level, callback) {
	local(theOS = sys.os());
	on traverse (path) { <<local handler -- actually does the traversing
		if currentlevel > level {
			return (true)};
		sys.systemTask (); <<give the Finder a shot at updating windows
		rollBeachBall ();
		local (f);
		fileloop (f in path) {
			if file.isFolder (f) {
				if not traverse (f) { <<recurse
					return (false)}; <<unwind recursion on error
			if not callback^ (f) { <<call the caller-supplied callback routine
				return (false)}}}; <<unwind recursion, callback says we're done
	local (currentlevel = 1);
	return (traverse (path))}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.