13
0

Extract program version that a session was created with

This commit is contained in:
Robin Gareus 2017-01-20 18:15:44 +01:00
parent de2612f7b4
commit bbe62da55a
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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;