Copy config.xml and cinemas.xml if they fail to load so data is not lost.
authorCarl Hetherington <cth@carlh.net>
Wed, 26 Apr 2017 09:13:49 +0000 (10:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 26 Apr 2017 09:13:49 +0000 (10:13 +0100)
ChangeLog
src/lib/config.cc

index 178601665718acd026d66038f16c6f4eabbe9cf6..b1ffde15b9955a514a271f8ce5a94fda524fcd55 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-04-26  Carl Hetherington  <cth@carlh.net>
+
+       * Make a copy of the configuration, if it fails to load, before making new defaults.
+
 2017-04-07  Carl Hetherington  <cth@carlh.net>
 
        * Make jump-to-content-start on selection in the content list
index 01a67522f264b8477f812dbbbd73c068d90f8e6b..10bee140c21b30c2eea74e77083d3c9f69dd1a8a 100644 (file)
@@ -323,6 +323,13 @@ try
 }
 catch (...) {
        if (have_existing ("config.xml")) {
+
+               /* Make a copy of the configuration */
+               try {
+                       boost::filesystem::copy (path ("config.xml", false), path ("config.xml.backup", false));
+                       boost::filesystem::copy (path ("cinemas.xml", false), path ("cinemas.xml.backup", false));
+               } catch (...) {}
+
                /* We have a config file but it didn't load */
                FailedToLoad ();
        }