From: Carl Hetherington Date: Mon, 24 Jul 2017 09:25:38 +0000 (+0100) Subject: Back-end support for linked configuration. X-Git-Tag: v2.11.15~28 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=4e8f322955a40570d53c0bb08f0e28bf3edb4a7d Back-end support for linked configuration. --- diff --git a/src/lib/config.cc b/src/lib/config.cc index 8dd4c4e0b..b7b7b2242 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -162,13 +162,25 @@ Config::create_certificate_chain () ); } +boost::filesystem::path +Config::target (boost::filesystem::path file) +{ + cxml::Document f ("Config"); + f.read_file (file); + optional link = f.optional_string_child ("Link"); + if (link) { + return target (*link); + } + + return file; +} + void Config::read () try { cxml::Document f ("Config"); - f.read_file (path ("config.xml")); - optional c; + f.read_file (target(path("config.xml"))); optional version = f.optional_number_child ("Version"); @@ -209,6 +221,7 @@ try _tms_user = f.string_child ("TMSUser"); _tms_password = f.string_child ("TMSPassword"); + optional c; c = f.optional_string_child ("SoundProcessor"); if (c) { _cinema_sound_processor = CinemaSoundProcessor::from_id (c.get ()); @@ -535,7 +548,7 @@ Config::write_config () const root->add_child("CoverSheet")->add_child_text (_cover_sheet); try { - doc.write_to_file_formatted (path("config.xml").string ()); + doc.write_to_file_formatted (target(path("config.xml")).string ()); } catch (xmlpp::exception& e) { string s = e.what (); trim (s); diff --git a/src/lib/config.h b/src/lib/config.h index 970810a77..200857aa9 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -646,6 +646,7 @@ public: private: Config (); static boost::filesystem::path path (std::string file, bool create_directories = true); + static boost::filesystem::path target (boost::filesystem::path file); void read (); void set_defaults (); void set_kdm_email_to_default ();