From c7b0c3db7dabab1a5988309c82057b4474ffdf6e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 14 Aug 2017 19:51:58 +0100 Subject: Try to fix errors when starting DoM on a machine with no config.xml. --- src/lib/config.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/config.cc b/src/lib/config.cc index 6c44e5153..f341799c4 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -166,8 +166,13 @@ void Config::read () try { + boost::filesystem::path const config_path = config_file (); + if (!boost::filesystem::exists (config_path)) { + return; + } + cxml::Document f ("Config"); - f.read_file (config_file()); + f.read_file (config_path); optional version = f.optional_number_child ("Version"); @@ -832,6 +837,12 @@ Config::config_file () { 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 link = f.optional_string_child("Link"); if (link) { -- cgit v1.2.3