diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-02-17 10:11:24 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-02-17 10:11:24 +0000 |
| commit | 4f19455332f1f4cc4c313338b7fb0b6fc508d5b4 (patch) | |
| tree | be960254d3017519805a8625444df3e5984e5d08 /src/lib | |
| parent | ce8798adfb206eb5c7c38167140a4a1474f7b3a4 (diff) | |
Allow multiple configuration files in DCP-o-matic's directory.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 16 | ||||
| -rw-r--r-- | src/lib/config.h | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 81acd9f62..d157207d0 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -139,7 +139,7 @@ Config::create_certificate_chain () void Config::read () { - if (!have_existing ()) { + if (!have_existing ("config.xml")) { /* Make a new set of signing certificates and key */ _signer_chain = create_certificate_chain (); /* And similar for decryption of KDMs */ @@ -149,7 +149,7 @@ Config::read () } cxml::Document f ("Config"); - f.read_file (file ()); + f.read_file (path ("config.xml")); optional<string> c; optional<int> version = f.optional_number_child<int> ("Version"); @@ -298,7 +298,7 @@ Config::read () /** @return Filename to write configuration to */ boost::filesystem::path -Config::file (bool create_directories) +Config::path (string file, bool create_directories) { boost::filesystem::path p; #ifdef DCPOMATIC_OSX @@ -315,7 +315,7 @@ Config::file (bool create_directories) if (create_directories) { boost::filesystem::create_directories (p, ec); } - p /= "config.xml"; + p /= file; return p; } @@ -433,11 +433,11 @@ Config::write () const } try { - doc.write_to_file_formatted (file().string ()); + doc.write_to_file_formatted (path("config.xml").string ()); } catch (xmlpp::exception& e) { string s = e.what (); trim (s); - throw FileError (s, file ()); + throw FileError (s, path("config.xml")); } } @@ -507,7 +507,7 @@ Config::add_to_history (boost::filesystem::path p) } bool -Config::have_existing () +Config::have_existing (string file) { - return boost::filesystem::exists (file (false)); + return boost::filesystem::exists (path (file, false)); } diff --git a/src/lib/config.h b/src/lib/config.h index 049b3663c..806853083 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -458,11 +458,11 @@ public: static Config* instance (); static void drop (); static void restore_defaults (); - static bool have_existing (); + static bool have_existing (std::string); private: Config (); - static boost::filesystem::path file (bool create_directories = true); + static boost::filesystem::path path (std::string file, bool create_directories = true); void read (); void set_defaults (); void set_kdm_email_to_default (); |
