+int
+ARDOUR::copy_configuration_files (string const & old_dir, string const & new_dir, int old_version)
+{
+ string old_name;
+ string new_name;
+
+ if (old_version == 3) {
+
+ old_name = Glib::build_filename (old_dir, "recent");
+ new_name = Glib::build_filename (new_dir, "recent");
+
+ copy_file (old_name, new_name);
+
+ /* can only copy ardour.rc - UI config is not compatible */
+
+ old_name = Glib::build_filename (old_dir, "ardour.rc");
+ new_name = Glib::build_filename (new_dir, "config");
+
+ copy_file (old_name, new_name);
+
+ /* copy templates and route templates */
+
+ old_name = Glib::build_filename (old_dir, "templates");
+ new_name = Glib::build_filename (new_dir, "templates");
+
+ copy_files (old_name, new_name);
+
+ old_name = Glib::build_filename (old_dir, "route_templates");
+ new_name = Glib::build_filename (new_dir, "route_templates");
+
+ copy_files (old_name, new_name);
+
+ /* presets */
+
+ old_name = Glib::build_filename (old_dir, "presets");
+ new_name = Glib::build_filename (new_dir, "presets");
+
+ copy_files (old_name, new_name);
+
+ /* presets */
+
+ old_name = Glib::build_filename (old_dir, "plugin_statuses");
+ new_name = Glib::build_filename (new_dir, "plugin_statuses");
+
+ copy_file (old_name, new_name);
+
+ /* export formats */
+
+ old_name = Glib::build_filename (old_dir, export_formats_dir_name);
+ new_name = Glib::build_filename (new_dir, export_formats_dir_name);
+
+ vector<string> export_formats;
+ g_mkdir_with_parents (Glib::build_filename (new_dir, export_formats_dir_name).c_str(), 0755);
+ find_files_matching_pattern (export_formats, old_name, "*.format");
+ for (vector<string>::iterator i = export_formats.begin(); i != export_formats.end(); ++i) {
+ std::string from = *i;
+ std::string to = Glib::build_filename (new_name, Glib::path_get_basename (*i));
+ copy_file (from, to);
+ }
+ }
+
+ return 0;
+}
+