Index: /trunk/gli/src/org/greenstone/gatherer/Configuration.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/Configuration.java	(revision 9868)
+++ /trunk/gli/src/org/greenstone/gatherer/Configuration.java	(revision 9869)
@@ -71,5 +71,4 @@
     static public String GS3_CONFIG_XML = "config3.xml";
 
-    static final private String CURRENT_CONFIGURATION_VERSION = "2.60";
     /** The name of the root element of the subtree containing gatherer configuration options. This is required as the document itself may contain several other subtrees of settings (such as in the case of a '.col' file). */
     static final private String GATHERER_CONFIG = "GathererConfig";
@@ -97,5 +96,5 @@
     static public Configuration self = null;
 
-    static public boolean just_created_new_config_file = false;
+    static public boolean just_updated_config_xml_file = false;
     /** The path to the Greenstone Suite installation directory. */
     static public String gsdl_path = "";
@@ -150,20 +149,10 @@
 	    config_xml_file_name = GS3_CONFIG_XML;
 	}
+
+	// If the existing user config.xml file isn't recent enough, backup the old version and update it
 	File config_xml_file = new File(Utility.getGLIUserFolder(), config_xml_file_name);
 	if (config_xml_file != null && config_xml_file.exists()) {
-	    general_config = Utility.parse(config_xml_file.getAbsolutePath(), false);
-	}
-
-	// If the version of the config we've loaded isn't recent enough, backup the old version and create a new one
-	just_created_new_config_file = false;
-	if (general_config != null) {
-	    Element configuration_element = general_config.getDocumentElement();
-	    String configuration_version = configuration_element.getAttribute(StaticStrings.VERSION_ATTRIBUTE);
-	    if (!configuration_version.equals(CURRENT_CONFIGURATION_VERSION)) {
-		// !!! JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Configuration.Obsolete_Config"), Dictionary.get("Configuration.Obsolete_Config_Title"), JOptionPane.ERROR_MESSAGE);
-		File backup = new File(config_xml_file.getAbsolutePath() + ".bak");
-		config_xml_file.renameTo(backup);
-		general_config = null;
-	    }
+	    just_updated_config_xml_file = updateUserConfigXMLFileIfNecessary(config_xml_file);
+	    general_config = XMLTools.parseXMLFile(config_xml_file);
 	}
 
@@ -171,5 +160,5 @@
 	if (general_config == null) {
 	    general_config = Utility.parse(TEMPLATE_CONFIG_XML, true);
-	    just_created_new_config_file = true;
+	    just_updated_config_xml_file = true;
 	}
 
@@ -210,4 +199,126 @@
 	    }
 	}
+    }
+
+
+    static private boolean updateUserConfigXMLFileIfNecessary(File config_xml_file)
+    {
+	// Check if the configuration file actually needs updating by looking at the version numbers
+	Document new_document = Utility.parse(TEMPLATE_CONFIG_XML, true);
+	Document old_document = XMLTools.parseXMLFile(config_xml_file);
+
+	String new_version = new_document.getDocumentElement().getAttribute(StaticStrings.VERSION_ATTRIBUTE);
+	String old_version = old_document.getDocumentElement().getAttribute(StaticStrings.VERSION_ATTRIBUTE);
+	if (new_version.compareTo(old_version) <= 0) {
+	    // Don't need to update file
+	    return false;
+	}
+
+	System.err.println("Updating user config.xml from version " + old_version + " to version " + new_version + "...");
+
+	// Build up the new user config.xml file from the template config.xml with the user's preferences added
+	// Make a backup of the old config.xml file first
+	config_xml_file.renameTo(new File(config_xml_file.getAbsolutePath() + ".old"));
+
+	// Check all of the Argument elements in the new config.xml file
+	NodeList new_argument_elements_nodelist = new_document.getElementsByTagName("Argument");
+	NodeList old_argument_elements_nodelist = old_document.getElementsByTagName("Argument");
+	for (int i = 0; i < new_argument_elements_nodelist.getLength(); i++) {
+	    Element new_argument_element = (Element) new_argument_elements_nodelist.item(i);
+	    String new_argument_element_name = new_argument_element.getAttribute("name");
+	    String new_argument_element_value = XMLTools.getElementTextValue(new_argument_element);
+
+	    // Did this Argument have a non-default value set?
+	    for (int j = old_argument_elements_nodelist.getLength() - 1; j >= 0; j--) {
+		Element old_argument_element = (Element) old_argument_elements_nodelist.item(j);
+		String old_argument_element_name = old_argument_element.getAttribute("name");
+
+		// Argument found
+		if (old_argument_element_name.equals(new_argument_element_name)) {
+		    String old_argument_element_value = XMLTools.getElementTextValue(old_argument_element);
+		    if (!old_argument_element_value.equals(new_argument_element_value)) {
+			XMLTools.setElementTextValue(new_argument_element, old_argument_element_value);
+		    }
+
+		    // We don't care about this option any more
+		    old_argument_element.getParentNode().removeChild(old_argument_element);
+		    break;
+		}
+	    }
+	}
+
+	// Are there any old Argument elements left over? Keep these around for old time's sake
+	old_argument_elements_nodelist = old_document.getElementsByTagName("Argument");
+	if (old_argument_elements_nodelist.getLength() > 0) {
+	    NodeList new_gathererconfig_elements_nodelist = new_document.getElementsByTagName("GathererConfig");
+	    if (new_gathererconfig_elements_nodelist.getLength() > 0) {
+		Element new_gathererconfig_element = (Element) new_gathererconfig_elements_nodelist.item(0);
+		new_gathererconfig_element.appendChild(new_document.createComment(" Legacy options "));
+
+		// Add the legacy Arguments to the GathererConfig element
+		for (int i = 0; i < old_argument_elements_nodelist.getLength(); i++) {
+		    Element old_argument_element = (Element) old_argument_elements_nodelist.item(i);
+		    new_gathererconfig_element.appendChild(new_document.importNode(old_argument_element, true));
+		}
+	    }
+	}
+
+	// Keep all the Mapping elements
+	NodeList new_directorymappings_elements_nodelist = new_document.getElementsByTagName("DirectoryMappings");
+	if (new_directorymappings_elements_nodelist.getLength() > 0) {
+	    Element new_directorymappings_element = (Element) new_directorymappings_elements_nodelist.item(0);
+
+	    NodeList old_mapping_elements_nodelist = old_document.getElementsByTagName("Mapping");
+	    for (int i = 0; i < old_mapping_elements_nodelist.getLength(); i++) {
+		Element old_mapping_element = (Element) old_mapping_elements_nodelist.item(i);
+		new_directorymappings_element.appendChild(new_document.importNode(old_mapping_element, true));
+	    }
+	}
+
+	// Check all of the Associations elements in the new config.xml file
+	NodeList new_entry_elements_nodelist = new_document.getElementsByTagName("Entry");
+	NodeList old_entry_elements_nodelist = old_document.getElementsByTagName("Entry");
+	for (int i = 0; i < new_entry_elements_nodelist.getLength(); i++) {
+	    Element new_entry_element = (Element) new_entry_elements_nodelist.item(i);
+	    String new_entry_element_name = new_entry_element.getAttribute("extension");
+	    String new_entry_element_value = XMLTools.getElementTextValue(new_entry_element);
+
+	    // Did this Entry have a non-default value set?
+	    for (int j = old_entry_elements_nodelist.getLength() - 1; j >= 0; j--) {
+		Element old_entry_element = (Element) old_entry_elements_nodelist.item(j);
+		String old_entry_element_name = old_entry_element.getAttribute("extension");
+
+		// Entry found
+		if (old_entry_element_name.equals(new_entry_element_name)) {
+		    String old_entry_element_value = XMLTools.getElementTextValue(old_entry_element);
+		    if (!old_entry_element_value.equals(new_entry_element_value)) {
+			XMLTools.setElementTextValue(new_entry_element, old_entry_element_value);
+		    }
+
+		    // We don't care about this option any more
+		    old_entry_element.getParentNode().removeChild(old_entry_element);
+		    break;
+		}
+	    }
+	}
+
+	// Are there any old Entry elements left over? We want to keep these
+	old_entry_elements_nodelist = old_document.getElementsByTagName("Entry");
+	if (old_entry_elements_nodelist.getLength() > 0) {
+	    NodeList new_associations_elements_nodelist = new_document.getElementsByTagName("Associations");
+	    if (new_associations_elements_nodelist.getLength() > 0) {
+		Element new_associations_element = (Element) new_associations_elements_nodelist.item(0);
+
+		// Add the legacy Entries to the Associations element
+		for (int i = 0; i < old_entry_elements_nodelist.getLength(); i++) {
+		    Element old_entry_element = (Element) old_entry_elements_nodelist.item(i);
+		    new_associations_element.appendChild(new_document.importNode(old_entry_element, true));
+		}
+	    }
+	}
+
+	// Write out the updated config.xml file
+	XMLTools.writeXMLFile(config_xml_file, new_document);
+	return true;
     }
 
Index: /trunk/gli/src/org/greenstone/gatherer/Gatherer.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 9868)
+++ /trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 9869)
@@ -146,5 +146,5 @@
 	    // Load GLI config file
 	    new Configuration(gsdl_path, gsdl3_path, site_name);
-	    if (Configuration.just_created_new_config_file) {
+	    if (Configuration.just_updated_config_xml_file) {
 		// Delete the plugins.dat and classifiers.dat files
 		PluginManager.clearPluginCache();
