diff options
author | Sakari Bergen <sakari.bergen@beatwaves.net> | 2011-03-12 21:28:58 +0000 |
---|---|---|
committer | Sakari Bergen <sakari.bergen@beatwaves.net> | 2011-03-12 21:28:58 +0000 |
commit | 751cc84dd2010a2c669a0155c0e2a0ce47d16592 (patch) | |
tree | ee66c35fc6cfdd841a8c3063a4afb4932edf3aeb /libs/ardour/export_profile_manager.cc | |
parent | 72928df58f70c833020fdabb81de38df0001e8af (diff) |
Properly create new presets, i.e. without duplicate id's on save-after-rename
git-svn-id: svn://localhost/ardour2/branches/3.0@9132 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/export_profile_manager.cc')
-rw-r--r-- | libs/ardour/export_profile_manager.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index cec6d0fefe..dc7e1f4308 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -181,11 +181,27 @@ ExportProfileManager::load_presets () } } +std::string +ExportProfileManager::preset_filename (std::string const & preset_name) +{ + string safe_name = legalize_for_path (preset_name); + return export_config_dir.to_string() + "/" + safe_name + export_preset_suffix; +} + +ExportProfileManager::PresetPtr +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)); + preset_list.push_back (current_preset); + return save_preset (name); +} + ExportProfileManager::PresetPtr ExportProfileManager::save_preset (string const & name) { - string safe_name = legalize_for_path (name); - string filename = export_config_dir.to_string() + "/" + safe_name + export_preset_suffix; + string filename = preset_filename (name); if (!current_preset) { current_preset.reset (new ExportPreset (filename, session)); |