diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-08-14 19:51:58 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-08-14 19:51:58 +0100 |
| commit | c7b0c3db7dabab1a5988309c82057b4474ffdf6e (patch) | |
| tree | efdd259a4048015b6fcf3f380933525459b69cf0 /src/lib | |
| parent | 12210ffdae9244eaf88c6d7dff0da46620ac20e0 (diff) | |
Try to fix errors when starting DoM on a machine with no config.xml.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 13 |
1 files changed, 12 insertions, 1 deletions
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<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); + 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) { |
