From 063ab23465759839eb723c20664cbfe388701fda Mon Sep 17 00:00:00 2001 From: Sakari Bergen Date: Thu, 16 Oct 2008 15:13:23 +0000 Subject: [PATCH] Handle export presets from config dirs properly. Removed some debug output. git-svn-id: svn://localhost/ardour2/branches/3.0@3977 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/export_preset.h | 2 +- libs/ardour/export_preset.cc | 3 ++- libs/ardour/export_profile_manager.cc | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/libs/ardour/ardour/export_preset.h b/libs/ardour/ardour/export_preset.h index 56c27f3442..de321aacd6 100644 --- a/libs/ardour/ardour/export_preset.h +++ b/libs/ardour/ardour/export_preset.h @@ -50,7 +50,7 @@ class ExportPreset { XMLNode const * get_global_state () const { return global.root(); } XMLNode const * get_local_state () const { return local; } - void save () const; + void save (std::string const & filename); void remove_local () const; private: diff --git a/libs/ardour/export_preset.cc b/libs/ardour/export_preset.cc index 620daa0f7f..1c19cae513 100644 --- a/libs/ardour/export_preset.cc +++ b/libs/ardour/export_preset.cc @@ -101,10 +101,11 @@ ExportPreset::set_local_state (XMLNode & state) } void -ExportPreset::save () const +ExportPreset::save (std::string const & filename) { save_instant_xml (); if (global.root()) { + global.set_filename (filename); global.write (); } } diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index b5d85fcfa2..600ce9e3ea 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -67,8 +67,6 @@ ExportProfileManager::ExportProfileManager (Session & s) : search_path += ardour_search_path().add_subdirectory_to_paths("export"); search_path += system_config_search_path().add_subdirectory_to_paths("export");; - std::cout << "search_path: " << search_path.to_string () << std::endl; - /* create export config directory if necessary */ if (!sys::exists (export_config_dir)) { @@ -163,8 +161,9 @@ ExportProfileManager::load_presets () ExportProfileManager::PresetPtr ExportProfileManager::save_preset (string const & name) { + string filename = export_config_dir.to_string() + "/" + name + export_preset_suffix; + if (!current_preset) { - string filename = export_config_dir.to_string() + "/" + name + export_preset_suffix; current_preset.reset (new ExportPreset (filename, session)); preset_list.push_back (current_preset); } @@ -179,7 +178,7 @@ ExportProfileManager::save_preset (string const & name) current_preset->set_global_state (*global_preset); current_preset->set_local_state (*local_preset); - current_preset->save(); + current_preset->save (filename); return current_preset; } @@ -210,12 +209,13 @@ void ExportProfileManager::load_preset_from_disk (PBD::sys::path const & path) { PresetPtr preset (new ExportPreset (path.to_string(), session)); - preset_list.push_back (preset); - /* Handle id to filename mapping */ + /* Handle id to filename mapping and don't add duplicates to list */ FilePair pair (preset->id(), path); - preset_file_map.insert (pair); + if (preset_file_map.insert (pair).second) { + preset_list.push_back (preset); + } } bool -- 2.30.2