diff --git a/libs/ardour/ardour/export_preset.h b/libs/ardour/ardour/export_preset.h index a952b1b76a..130adfd893 100644 --- a/libs/ardour/ardour/export_preset.h +++ b/libs/ardour/ardour/export_preset.h @@ -35,7 +35,7 @@ class Session; class LIBARDOUR_API ExportPreset { public: - ExportPreset (std::string filename, Session & s); + ExportPreset (Session&, std::string const& filename = ""); ~ExportPreset (); PBD::UUID const & id () const { return _id; } diff --git a/libs/ardour/export_preset.cc b/libs/ardour/export_preset.cc index ebc2b0004d..d12f9ad680 100644 --- a/libs/ardour/export_preset.cc +++ b/libs/ardour/export_preset.cc @@ -26,12 +26,19 @@ using namespace std; using namespace ARDOUR; -ExportPreset::ExportPreset (string filename, Session & s) : - session (s), global (filename), local (0) +ExportPreset::ExportPreset (Session& s, string const& filename) + : session (s) + , local (0) { - XMLNode * root; - std::string str; + if (filename.empty ()) { + return; + } + + global.read (filename); + + XMLNode* root; if ((root = global.root())) { + std::string str; if (root->get_property ("id", str)) { set_id (str); } diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index 3765ac6ccc..d53faa8828 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -227,9 +227,8 @@ ExportProfileManager::preset_filename (std::string const& preset_name) ExportPresetPtr ExportProfileManager::new_preset (string const& name) { - // Generate new ID and do regular save - string filename = preset_filename (name); - current_preset.reset (new ExportPreset (filename, session)); + // Generate new and do regular save + current_preset.reset (new ExportPreset (session)); preset_list.push_back (current_preset); return save_preset (name); } @@ -240,7 +239,7 @@ ExportProfileManager::save_preset (string const& name) string filename = preset_filename (name); if (!current_preset) { - current_preset.reset (new ExportPreset (filename, session)); + current_preset.reset (new ExportPreset (session, filename)); preset_list.push_back (current_preset); } @@ -288,7 +287,7 @@ ExportProfileManager::remove_preset () void ExportProfileManager::load_preset_from_disk (std::string const& path) { - ExportPresetPtr preset (new ExportPreset (path, session)); + ExportPresetPtr preset (new ExportPreset (session, path)); /* Handle id to filename mapping and don't add duplicates to list */