summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
authorJohannes Mueller <github@johannes-mueller.org>2020-04-02 01:01:31 +0200
committerJohannes Mueller <github@johannes-mueller.org>2020-04-02 14:37:12 +0200
commit7a2e9bf2244a30c4075578d92081219a36022197 (patch)
tree8876bfe035a6db18499e17367f69e1e51481e126 /libs/ardour/session.cc
parent64cb0a6e4bfd09591eb247b23970b3eeb334ca27 (diff)
Re-save templates if they have been loaded from an older version of Ardour
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc16
1 files changed, 16 insertions, 0 deletions
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"));
}