projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
12210ff
)
Try to fix errors when starting DoM on a machine with no config.xml.
author
Carl Hetherington
<cth@carlh.net>
Mon, 14 Aug 2017 18:51:58 +0000
(19:51 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Mon, 14 Aug 2017 18:51:58 +0000
(19:51 +0100)
src/lib/config.cc
patch
|
blob
|
history
diff --git
a/src/lib/config.cc
b/src/lib/config.cc
index 6c44e5153c5fb96e9f8ce3849b590a12d4df538f..f341799c4597cf815e7349c48362baf211f9ea65 100644
(file)
--- a/
src/lib/config.cc
+++ b/
src/lib/config.cc
@@
-166,8
+166,13
@@
void
Config::read ()
try
{
Config::read ()
try
{
+ boost::filesystem::path const config_path = config_file ();
+ if (!boost::filesystem::exists (config_path)) {
+ return;
+ }
+
cxml::Document f ("Config");
cxml::Document f ("Config");
- f.read_file (config_
file()
);
+ f.read_file (config_
path
);
optional<int> version = f.optional_number_child<int> ("Version");
optional<int> version = f.optional_number_child<int> ("Version");
@@
-832,6
+837,12
@@
Config::config_file ()
{
cxml::Document f ("Config");
boost::filesystem::path main = path("config.xml", false);
{
cxml::Document f ("Config");
boost::filesystem::path main = path("config.xml", false);
+ if (!boost::filesystem::exists (main)) {
+ /* It doesn't exist, so there can't be any links; just return it */
+ return main;
+ }
+
+ /* See if there's a link */
f.read_file (main);
optional<string> link = f.optional_string_child("Link");
if (link) {
f.read_file (main);
optional<string> link = f.optional_string_child("Link");
if (link) {