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));
}
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 ();
wxSplashScreen* splash = 0;
try {
- if (!Config::have_existing ()) {
+ if (!Config::have_existing ("config.xml")) {
wxBitmap bitmap;
boost::filesystem::path p = shared_path () / "splash.png";
if (bitmap.LoadFile (std_to_wx (p.string ()), wxBITMAP_TYPE_PNG)) {