_player_watermark_theatre = "";
_player_watermark_period = 1;
_player_watermark_duration = 50;
- _allow_spl_editing = true;
+ _player_lock_file = boost::none;
#endif
_allowed_dcp_frame_rates.clear ();
Config::read ()
try
{
-#ifdef DCPOMATIC_VARIANT_SWAROOP
+#if defined(DCPOMATIC_VARIANT_SWAROOP) && defined(DCPOMATIC_LINUX)
if (geteuid() == 0) {
/* Take ownership of the config file if we're root */
chown (config_file().string().c_str(), 0, 0);
BOOST_FOREACH (cxml::ConstNodePtr i, f.node_children("RequiredMonitor")) {
_required_monitors.push_back(Monitor(i));
}
- _allow_spl_editing = f.optional_bool_child("AllowSPLEditing").get_value_or(true);
+ _player_lock_file = f.optional_string_child("PlayerLockFile");
#endif
/* Replace any cinemas from config.xml with those from the configured file */
}
if (_default_container) {
/* [XML:opt] DefaultContainer ID of default container
- * to use when creating new films (<code>185</code>,<code>239</code> or
- * <code>190</code>).
+ to use when creating new films (<code>185</code>,<code>239</code> or
+ <code>190</code>).
*/
root->add_child("DefaultContainer")->add_child_text (_default_container->id ());
}
BOOST_FOREACH (dcp::Certificate const & i, _signer_chain->unordered()) {
signer->add_child("Certificate")->add_child_text (i.certificate (true));
}
+#ifdef DCPOMATIC_SWAROOP
+ FILE* f = fopen_boost (path("private"), "wb");
+ if (!f) {
+ throw FileError ("Could not open file for writing", path("private"));
+ }
+ shared_array<uint8_t> iv = dcpomatic::random_iv ();
+ dcp::Data encrypted_key = dcpomatic::encrypt (_signer_chain->key().get(), key, iv);
+ fwrite (encrypted_key.data().get(), encrypted_key.data().size(), 1, f);
+ fclose (f);
+#else
signer->add_child("PrivateKey")->add_child_text (_signer_chain->key().get ());
+#endif
/* [XML] Decryption Certificate chain and private key to use when decrypting KDMs */
xmlpp::Element* decryption = root->add_child ("Decryption");
BOOST_FOREACH (Monitor i, _required_monitors) {
i.as_xml(root->add_child("RequiredMonitor"));
}
- root->add_child("AllowSPLEditing")->add_child_text(_allow_spl_editing ? "1" : "0");
+ if (_player_lock_file) {
+ root->add_child("PlayerLockFile")->add_child_text(_player_lock_file->string());
+ }
#endif
try {
- doc.write_to_file_formatted(config_file().string());
+ string const s = doc.write_to_string_formatted ();
+ boost::filesystem::path const cf = config_file ();
+ FILE* f = fopen_boost (cf, "w");
+ if (!f) {
+ throw FileError (_("Could not open file for writing"), cf);
+ }
+ size_t const w = fwrite (s.c_str(), 1, s.length(), f);
+ if (w != s.length()) {
+ fclose (f);
+ throw FileError (_("Could not write whole file"), cf);
+ }
+ fclose (f);
} catch (xmlpp::exception& e) {
string s = e.what ();
trim (s);
- throw FileError (s, path("config.xml"));
+ throw FileError (s, config_file());
}
}