Monday, November 08, 2010 at 12:04 AM.
system.verbs.builtins.radio.backup.verifyStories
on verifyStories (adrErrorCallback=nil) { <<Changes <<11/30/02; 3:53:34 PM by JES <<Created. Verify backed up story files. local (pc = file.getpathchar (), foldername = radio.data.folderNames.wwwStoriesSubFolderName); local (storiesfolder = user.radio.prefs.wwwfolder + foldername + pc); local (backupfolder = user.radio.backup.prefs.folder + "stories" + pc); local (errormessage, flerror = false); on error (s) { //call the error callback flerror = true; if adrErrorCallback != nil { return (adrErrorCallback^ ("Verification of backup failed because " + s))}}; on verifyOneStory (f) { local (fname = file.fileFromPath (f)); local (partialpath = string.delete (f, 1, sizeOf (storiesfolder)) ); local (fbackup = backupfolder + partialpath); if not file.exists (fbackup) { errormessage = "the story file, \"" + fname + "\" does not exist."; return (false)}; if not file.readWholeFile (f) == file.readWholeFile (fbackup) { errormessage = "the backup of story file, \"" + fname + "\" is different from the original."; return (false)}; return (true)}; fileloop (f in storiesfolder, infinity) { if not file.isVisible (f) { continue}; if file.fileFromPath (f) beginsWith "." { continue}; if not verifyOneStory (f) { if not error (errormessage) {return (false)}}}; return (not flerror)}; bundle { //test code on errorCallback (s) { dialog.alert (s); return (true)}; verifyStories (@errorCallback)}
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.