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

system.verbs.apps.FinderMenu.commands.reconciler

<<Tue, Feb 11, 1997 at 3:33:08 AM by DW
	<<There isn't enough stack space in the Finder to run a complex reconcile
	<<So I changed the command to do the reconciling in a separate Frontier thread.
	<<Let's look for other places where FinderMenu might recurse very deeply.
<<Fri, Dec 5, 1997 at 1:41:58 AM by PBS
	<<Changed call to toys.threadCall to thread.easyCall.
local (sourcepath, destpath);
on getfolders () {
	local (sellist = FinderMenu.getSelectionList ());
	if sizeof (sellist) != 2 {
		scriptError ("Please select exactly two folders.")};
	on getfolder () {
		local (f = sellist [1]);
		delete (@sellist [1]);
		if file.isalias (f) {
			f = file.followAlias (f)};
		if not file.isfolder (f) {
			scriptError (f + " is not a folder.")};
		return (f)};
	sourcepath = getfolder ();
	destpath = getfolder ()};
getfolders ();

local (dlogResource = findermenu.commands.reconcileDialog.copyToResourceFork ());
on doDialog () {
	local { <<names of the fields of the dialog
		okitem = 1;
		cancelitem = 2;
		switchitem = 3;
		sourceitem = 4;
		destitem = 5};
	local (cancelled = false);
	on copytodialog () {
		dialog.setvalue (sourceitem, sourcepath);
		dialog.setvalue (destitem, destpath)};
	on copyfromdialog () {
		on check (msg, f) {
			if file.exists (f) and file.isFolder (f) {
				return (true)};
			dialog.alert (msg + " is not a folder, or it doesn't exist.");
			return (false)};
		local (f);
		f = dialog.getvalue (sourceitem);
		if not check ("Source folder", f) {
			return (false)};
		sourcepath = f;
		
		f = dialog.getvalue (destitem);
		if not check ("Destination folder", f) {
			return (false)};
		destpath = f;
		
		return (true)};
	on itemhit (item) {
		case item {
			-1 {
				copytodialog ();
				return (true)};
			okitem {
				if copyfromdialog () {
					return (false)}};
			cancelitem {
				cancelled = true;
				return (false)};
			switchitem {
				local (s1, s2);
				s1 = dialog.getvalue (sourceitem);
				s2 = dialog.getvalue (destitem);
				dialog.setvalue (sourceitem, s2);
				dialog.setvalue (destitem, s1)}}
		else {
			return (true)}}; <<keep going if item isn't OK or Cancel
	
	dialog.run (dlogResource, okitem, @itemhit);
	return (not cancelled)};
if doDialog () {
	thread.easyCall ("file.reconcileFolder", {sourcepath, destpath, @msg})};
msg ("")



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.