From: Carl Hetherington Date: Wed, 26 Apr 2017 09:13:49 +0000 (+0100) Subject: Copy config.xml and cinemas.xml if they fail to load so data is not lost. X-Git-Tag: v2.11.1~15 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=56abd650a3e915c398db8dbeaf5260452234ac9f;p=dcpomatic.git Copy config.xml and cinemas.xml if they fail to load so data is not lost. --- diff --git a/ChangeLog b/ChangeLog index 178601665..b1ffde15b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-04-26 Carl Hetherington + + * Make a copy of the configuration, if it fails to load, before making new defaults. + 2017-04-07 Carl Hetherington * Make jump-to-content-start on selection in the content list diff --git a/src/lib/config.cc b/src/lib/config.cc index 01a67522f..10bee140c 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -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 (); }