+2016-07-14 Carl Hetherington <cth@carlh.net>
+
+ * Use default configuration if the config.xml failed to load;
+ may help with #917.
+
2016-07-12 Carl Hetherington <cth@carlh.net>
* Version 2.9.2 released.
using boost::algorithm::trim;
Config* Config::_instance = 0;
+boost::signals2::signal<void ()> Config::FailedToLoad;
/** Construct default configuration */
Config::Config ()
void
Config::read ()
+try
{
- 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 */
- _decryption_chain = create_certificate_chain ();
- write ();
- return;
- }
-
cxml::Document f ("Config");
f.read_file (path ("config.xml"));
optional<string> c;
read_cinemas (f);
}
}
+catch (...) {
+ if (have_existing ("config.xml")) {
+ /* We have a config file but it didn't load */
+ FailedToLoad ();
+ }
+ set_defaults ();
+ /* Make a new set of signing certificates and key */
+ _signer_chain = create_certificate_chain ();
+ /* And similar for decryption of KDMs */
+ _decryption_chain = create_certificate_chain ();
+ write ();
+}
+
/** @return Filename to write configuration to */
boost::filesystem::path
void changed (Property p = OTHER);
boost::signals2::signal<void (Property)> Changed;
+ /** Emitted if ::read() failed on an existing Config file. There is nothing
+ a listener can do about it: this is just for information.
+ */
+ static boost::signals2::signal<void ()> FailedToLoad;
void write () const;
{
wxInitAllImageHandlers ();
+ Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
+
wxSplashScreen* splash = 0;
try {
if (!Config::have_existing ("config.xml")) {
}
}
+ void config_failed_to_load ()
+ {
+ message_dialog (_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
+ }
+
DOMFrame* _frame;
shared_ptr<wxTimer> _timer;
string _film_to_load;