From 7a2e9bf2244a30c4075578d92081219a36022197 Mon Sep 17 00:00:00 2001 From: Johannes Mueller Date: Thu, 2 Apr 2020 01:01:31 +0200 Subject: Re-save templates if they have been loaded from an older version of Ardour --- libs/ardour/session.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libs/ardour/session.cc') diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 1dedb86ade..379447b3a1 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -341,6 +341,9 @@ Session::Session (AudioEngine &eng, assert (AudioEngine::instance()->running()); immediately_post_engine (); + bool need_template_resave = false; + std::string template_description; + if (_is_new) { Stateful::loading_state_version = CURRENT_SESSION_FILE_VERSION; @@ -369,6 +372,15 @@ Session::Session (AudioEngine &eng, } catch (PBD::unknown_enumeration& e) { throw SessionException (_("Failed to parse template/snapshot state")); } + + if (state_tree && Stateful::loading_state_version < CURRENT_SESSION_FILE_VERSION) { + need_template_resave = true; + XMLNode const & root (*state_tree->root()); + XMLNode* desc_nd = root.child (X_("description")); + if (desc_nd) { + template_description = desc_nd->attribute_value(); + } + } store_recent_templates (mix_template); } @@ -449,6 +461,10 @@ Session::Session (AudioEngine &eng, session_loaded (); _is_new = false; + if (need_template_resave) { + save_template (mix_template, template_description, true); + } + BootMessage (_("Session loading complete")); } -- cgit v1.2.3