13
0

Re-save templates if they have been loaded from an older version of Ardour

This commit is contained in:
Johannes Mueller 2020-04-02 01:01:31 +02:00
parent 64cb0a6e4b
commit 7a2e9bf224

View File

@ -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"));
}