From ae4604a24b765bf23148305438097f35b5e5fb48 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 2 Dec 2018 01:37:33 +0100 Subject: [PATCH] Implement AU plugin-preset removal --- libs/ardour/audio_unit.cc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index e55d0c61c8..812d004e6a 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -2220,8 +2220,31 @@ AUPlugin::load_preset (PresetRecord r) } void -AUPlugin::do_remove_preset (std::string) +AUPlugin::do_remove_preset (std::string preset_name) { + vector v; + + std::string m = maker(); + std::string n = name(); + + strip_whitespace_edges (m); + strip_whitespace_edges (n); + + v.push_back (Glib::get_home_dir()); + v.push_back ("Library"); + v.push_back ("Audio"); + v.push_back ("Presets"); + v.push_back (m); + v.push_back (n); + v.push_back (preset_name + preset_suffix); + + Glib::ustring user_preset_path = Glib::build_filename (v); + + DEBUG_TRACE (DEBUG::AudioUnits, string_compose("AU Deleting Preset file %1\n", user_preset_path)); + + if (g_unlink (user_preset_path.c_str())) { + error << string_compose (X_("Could not delete preset at \"%1\": %2"), user_preset_path, strerror (errno)) << endmsg; + } } string -- 2.30.2