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

system.verbs.builtins.radio.backup.restoreTemplates

on restoreTemplates (adrReadFileCallback, adrfiles) {
	<<Changes
		<<1/15/03; 1:02:52 PM by JES
			<<Rewrite: Restore template files from their plain-text backups instead of from a single .fttb file.
		<<11/30/02; 11:34:01 PM by JES
			<<Rewrite. The method used in this script's initial implementation didn't work properly.
		<<11/27/02; 12:51:18 AM by JES
			<<Created.
	local (adrfile, pc = file.getPathChar ());
	for adrfile in adrfiles {
		local (partialpath = nameOf (adr^));
		if string.lower (partialpath) beginsWith "templates" {
			local (f = user.radio.prefs.wwwFolder + "#" + string.nthField (partialPath, "/", 2));
			file.sureFilePath (f);
			if file.exists (f) { //only replace the file if it's new or changed
				if file.modified (f) == adr^.modified and file.size (f) == adr^.size {
					continue}};
			file.writeWholeFile (f, adrReadFileCallback^ (partialPath));
			file.setCreated (f, adr^.created);
			file.setModified (f, adr^.modified)}};
	return (true)}



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.