From bbe62da55a5fb06ba39e02c9671a94ab6e24bb08 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 20 Jan 2017 18:15:44 +0100 Subject: [PATCH] Extract program version that a session was created with --- libs/ardour/ardour/session.h | 2 +- libs/ardour/session_state.cc | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index fb0860bd78..562b8a94c2 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -199,7 +199,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop virtual ~Session (); - static int get_info_from_path (const std::string& xmlpath, float& sample_rate, SampleFormat& data_format); + static int get_info_from_path (const std::string& xmlpath, float& sample_rate, SampleFormat& data_format, std::string& created_version); static std::string get_snapshot_from_instant (const std::string& session_dir); /** a monotonic counter used for naming user-visible things uniquely diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 04f6470582..ee86a40e09 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -4428,10 +4428,11 @@ Session::rename (const std::string& new_name) } int -Session::get_info_from_path (const string& xmlpath, float& sample_rate, SampleFormat& data_format) +Session::get_info_from_path (const string& xmlpath, float& sample_rate, SampleFormat& data_format, std::string& created_version) { bool found_sr = false; bool found_data_format = false; + created_version = ""; if (!Glib::file_test (xmlpath, Glib::FILE_TEST_EXISTS)) { return -1; @@ -4468,6 +4469,13 @@ Session::get_info_from_path (const string& xmlpath, float& sample_rate, SampleFo node = node->children; while (node != NULL) { + if (!strcmp((const char*) node->name, "ProgramVersion")) { + xmlChar* val = xmlGetProp (node, (const xmlChar*)"created-with"); + if (val) { + created_version = string ((const char*)val); + } + xmlFree (val); + } if (strcmp((const char*) node->name, "Config")) { node = node->next; continue; -- 2.30.2