Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.upstream.inPoundFolder
on inPoundFolder (f, topfolder=user.radio.prefs.upstream.folder) {
<<Changes
<<2/3/02; 2:08:41 AM by JES
<<Fixed a bug where if f is the path to a file whose name begins with the # character, inPoundFolder would return true, even if name of the folder containing the file doesn't begin with the # character.
<<1/31/02; 2:48:19 AM by JES
<<Use a string comparison to determine whether a file is at a path which has a folder with a # character on the way to the file. Prevents errors when the file or a folder on the path to the file no longer exists.
<<This may represent a small performance improvement, but more importantly addresses a problem where a parent folder of the file specified by f, no longer exists. In this situation, when called from radio.upstream.checkForDeletions, it caused an error which prevented files from being deleted from the server, when their enclosing folder had been deleted.
<<12/12/01; 8:29:01 PM by DW
<<Created. Return true if the file is contained within a folder whose name begins with a pound sign.
local (pc = file.getPathChar ());
local (nomad = string.lower (f));
nomad = string.popSuffix (nomad, pc);
nomad = string.delete (nomad, 1, sizeOf (topfolder) - 1);
return (nomad contains (pc + "#"))}
<<loop
<<if nomad == string.lower (topfolder)
<<return (false)
<<nomad = file.folderfrompath (nomad)
<<if file.filefrompath (nomad) beginswith "#"
<<return (true)
<<bundle //test code
<<local (f = user.radio.prefs.upstream.folder + "#scriptingCom\\test\\hello\\")
<<local (startticks = clock.ticks ())
<<for i = 1 to 1000
<<inPoundFolder (f)
<<dialog.alert (clock.ticks () - startticks)
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.