Remove the template description XMLNode before saving the template
... to avoid that the new template description is concatenated to the old one.
This commit is contained in:
parent
419b1c1cfd
commit
bd4db1e151
|
@ -256,14 +256,14 @@ TemplateManager::save_template_desc ()
|
|||
return;
|
||||
}
|
||||
|
||||
XMLNode* desc = tree.root()->child (X_("description"));
|
||||
if (!desc) {
|
||||
desc = new XMLNode (X_("description"));
|
||||
tree.root()->add_child_nocopy (*desc);
|
||||
}
|
||||
tree.root()->remove_nodes (X_("description"));
|
||||
XMLNode* desc = new XMLNode (X_("description"));
|
||||
|
||||
XMLNode* dn = new XMLNode (X_("content"), desc_txt);
|
||||
desc->add_child_nocopy (*dn);
|
||||
|
||||
tree.root()->add_child_nocopy (*desc);
|
||||
|
||||
if (!tree.write ()) {
|
||||
error << string_compose(X_("Could not write to template file \"%1\"."), file_path) << endmsg;
|
||||
return;
|
||||
|
|
|
@ -4022,6 +4022,7 @@ Route::save_as_template (const string& path, const string& name, const string& d
|
|||
XMLNode& node (state (false));
|
||||
node.set_property (X_("name"), name);
|
||||
|
||||
node.remove_nodes (X_("description"));
|
||||
if (!description.empty()) {
|
||||
XMLNode* desc = new XMLNode(X_("description"));
|
||||
XMLNode* desc_cont = new XMLNode(X_("content"), description);
|
||||
|
|
|
@ -2414,12 +2414,13 @@ Session::save_template (const string& template_name, const string& description,
|
|||
XMLNode* root;
|
||||
{
|
||||
PBD::Unwinder<std::string> uw (_template_state_dir, template_dir_path);
|
||||
root = &get_template();
|
||||
root = &get_template ();
|
||||
}
|
||||
|
||||
root->remove_nodes (X_("description"));
|
||||
if (!description.empty()) {
|
||||
XMLNode* desc = new XMLNode(X_("description"));
|
||||
XMLNode* desc_cont = new XMLNode(X_("content"), description);
|
||||
XMLNode* desc = new XMLNode (X_("description"));
|
||||
XMLNode* desc_cont = new XMLNode (X_("content"), description);
|
||||
desc->add_child_nocopy (*desc_cont);
|
||||
|
||||
root->add_child_nocopy (*desc);
|
||||
|
|
Loading…
Reference in New Issue