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

system.verbs.builtins.radio.weblog.file.getArchiveFilePath

on getArchiveFilePath (folder, d, flCreateFolders=true, ext="txt") {
	<<Changes
		<<1/5/02; 5:06:25 PM by JES
			<<Given the path to a folder on disk, and a date, return the path to the archive file for the date.
			<<Parameters
				<<folder -- the folder in which the archive file will be saved
				<<d -- the date for the archive file
				<<flCreateFolders -- if true, folders on the path to the archive file for the specified date will be created
				<<ext -- the file extension -- defaults to txt
	local (day, month, year, hour, minute, second);
	local (pc = file.getPathChar ());
	date.get (d, @day, @month, @year, @hour, @minute, @second);
	year = string (year);
	month = string.padWithZeros (month, 2);
	day = string.padWithZeros (day, 2);
	local (archiveFilePath = folder + year + pc + month + pc + day + "." + ext);
	if flCreateFolders {
		file.sureFilePath (archiveFilePath)};
	return (archiveFilePath)}
<<bundle //test code
	<<dialog.notify (getArchiveFilePath (user.radio.prefs.wwwFolder, clock.now ()))



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.