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 */
}
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");
/** @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
if (create_directories) {
boost::filesystem::create_directories (p, ec);
}
- p /= "config.xml";
+ p /= file;
return p;
}
}
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"));
}
}
}
bool
-Config::have_existing ()
+Config::have_existing (string file)
{
- return boost::filesystem::exists (file (false));
+ return boost::filesystem::exists (path (file, false));
}