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


on pathToAddress (path, nomad=@root) {
	<<March 13, 1998 at 5:38:13 PM by WMF
		<<This script converts a URL-style path to an address
		<<I noticed that this code was in almost all of my responders
		<<This code was written by Dave Winer
	path = string.popLeading (path, "/");
	bundle { //walk the doc tree
		local (remainder = path, firstpart);
		loop {
			if remainder == "" {
			firstpart = string.nthfield (remainder, '/', 1);
			remainder = string.delete (remainder, 1, sizeof (firstpart) + 1);
			nomad = @nomad^.[firstpart]}};
	return (nomad)}
<<bundle // testing
	<<webserver.util.pathToAddress ("/workspace/notepad")

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.