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


on fileInfo (path) {
	if not file.exists (path) {
		scripterror ("File " + file.filefrompath (path) + " doesn't exist.")};
	<<bundle <<old dialog code
			<<okitem = 13
			<<nameitem = 7
			<<folderitem = 8
			<<createditem = 9
			<<modifieditem = 10
			<<sizeitem = 11
			<<versionitem = 12
			<<typeitem = 15
			<<creatoritem = 17
		<<on copytodialog () <<copy info about "path" into the dialog
			<<dialog.setvalue (nameitem, file.filefrompath (path))
			<<dialog.setvalue (folderitem, file.folderfrompath (path))
			<<dialog.setvalue (createditem, file.created (path))
			<<dialog.setvalue (modifieditem, file.modified (path))
			<<dialog.setvalue (sizeitem, file.size (path) / 1024 + "K bytes")
			<<dialog.setvalue (typeitem, file.type (path))
			<<dialog.setvalue (creatoritem, file.creator (path))
			<<bundle <<set the version number
				<<local (s = "n/a")
				<<if not file.isVolume (path)
					<<if not file.isbusy (path)
						<<if not file.isFolder (path)
							<<s = file.getVersion (path)
				<<dialog.setvalue (versionitem, s)
		<<on itemhit (item)
			<<case item
					<<copytodialog ()
					<<return (true)
					<<bundle <<rename file
						<<local (newpath)
						<<newpath = dialog.getvalue (nameitem)
						<<if not file.exists (newpath)
							<<speaker.beep ()
							<<return (true) <<keep processing the dialog
						<<path = newpath
						<<copytodialog ()
					<<return (false)
				<<return (true) <<keep going if item isn't OK
		<< (270, okitem, @itemhit)
	local (f = filespec (path)); (;
	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.