From 7a524285385d4581ad3f1e085629379e32f82fda Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Tue, 8 May 2018 13:00:27 -0500 Subject: Plugin Order: remove from instant.xml and save to: plugin_metadata/plugin_order --- libs/ardour/plugin_manager.cc | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'libs/ardour/plugin_manager.cc') diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 233f986a7b..d5d98cb54f 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -1537,6 +1537,43 @@ PluginManager::user_plugin_metadata_dir () const return dir; } +bool +PluginManager::load_plugin_order_file (XMLNode &n) const +{ + std::string path = Glib::build_filename (user_plugin_metadata_dir(), "plugin_order"); + + info << string_compose (_("Loading plugin order file %1"), path) << endmsg; + if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { + return false; + } + + XMLTree tree; + if (tree.read (path)) { + n = *(tree.root()); + return true; + } else { + error << string_compose (_("Cannot parse Plugin Order info from %1"), path) << endmsg; + return false; + } +} + + +void +PluginManager::save_plugin_order_file (XMLNode &elem) const +{ + std::string path = Glib::build_filename (user_plugin_metadata_dir(), "plugin_order"); + + info << string_compose (_("Saving plugin order file %1"), path) << endmsg; + + XMLTree tree; + tree.set_root (&elem); + if (!tree.write (path)) { + error << string_compose (_("Could not save Plugin Order info to %1"), path) << endmsg; + } + tree.set_root (0); //note: must disconnect the elem from XMLTree, or it will try to delete memory it didn't allocate +} + + void PluginManager::save_tags () { -- cgit v1.2.3