X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Ftemplate_utils.cc;h=f6b6c59fbce1967c74046c0677082a8802e937ea;hb=fb01698450e5cb88c7e58fb3a5ebe6294731fdfe;hp=13674cd51defcfcdd56ca5698edf319d2f6748b3;hpb=908369ab3e31f82eae3734cfe61421912d2fba6a;p=ardour.git diff --git a/libs/ardour/template_utils.cc b/libs/ardour/template_utils.cc index 13674cd51d..f6b6c59fbc 100644 --- a/libs/ardour/template_utils.cc +++ b/libs/ardour/template_utils.cc @@ -101,26 +101,32 @@ find_session_templates (vector& template_names, bool read_xml) rti.path = *i; if (read_xml) { + XMLTree tree; if (!tree.read (file.c_str())) { + cerr << "Failed to parse Route-template XML file: " << file; continue; } - string created_with = "(unknown)"; - XMLNode *pv = tree.root()->child("ProgramVersion"); - if (pv != 0) { - pv->get_property (X_("created-with"), created_with); - } - - string description = "No Description"; - XMLNode *desc = tree.root()->child("description"); - if (desc != 0) { - description = desc->attribute_value(); - } - - rti.created_with = created_with; - rti.description = description; - + XMLNode* root = tree.root(); + + rti.modified_with = _("(unknown)"); + try { + XMLNode *pv = root->child("ProgramVersion"); + string modified_with; + if (pv != 0) { + pv->get_property (X_("modified-with"), modified_with); + } + rti.modified_with = modified_with; + } catch (XMLException &e) {} + + rti.description = _("No Description"); + try { + XMLNode *desc = root->child("description"); + if (desc != 0) { + rti.description = desc->attribute_value(); + } + } catch (XMLException &e) {} } template_names.push_back (rti); @@ -144,6 +150,7 @@ find_route_templates (vector& template_names) XMLTree tree; if (!tree.read (fullpath.c_str())) { + cerr << "Failed to parse Route-template XML file: " << fullpath; continue; } @@ -151,6 +158,24 @@ find_route_templates (vector& template_names) TemplateInfo rti; + rti.modified_with = _("(unknown)"); + try { + XMLNode *pv = root->child("ProgramVersion"); + string modified_with; + if (pv != 0) { + pv->get_property (X_("modified-with"), modified_with); + } + rti.modified_with = modified_with; + } catch (XMLException &e) {} + + rti.description = _("No Description"); + try { + XMLNode *desc = root->child("description"); + if (desc != 0) { + rti.description = desc->attribute_value(); + } + } catch (XMLException &e) {} + rti.name = IO::name_from_state (*root->children().front()); rti.path = fullpath;