summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-07-24 10:25:38 +0100
committerCarl Hetherington <cth@carlh.net>2017-07-24 10:25:38 +0100
commit4e8f322955a40570d53c0bb08f0e28bf3edb4a7d (patch)
treef2f6b41840bef3f81c5b867e7fb4c5e508adee5a /src
parent3c49cb49f7dd95878f504d4245b202e0a2c23c7c (diff)
Back-end support for linked configuration.
Diffstat (limited to 'src')
-rw-r--r--src/lib/config.cc19
-rw-r--r--src/lib/config.h1
2 files changed, 17 insertions, 3 deletions
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<string> 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<string> c;
+ f.read_file (target(path("config.xml")));
optional<int> version = f.optional_number_child<int> ("Version");
@@ -209,6 +221,7 @@ try
_tms_user = f.string_child ("TMSUser");
_tms_password = f.string_child ("TMSPassword");
+ optional<string> 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 ();