From 8fab267ea6ff0a77fd0689cc90689a3850c2ec74 Mon Sep 17 00:00:00 2001 From: Aaron Rossetto Date: Thu, 12 Dec 2019 08:46:07 -0600 Subject: prefs: Output debug trace when config file cannot be located or loaded --- host/lib/utils/config_parser.cpp | 2 +- host/lib/utils/prefs.cpp | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'host/lib/utils') diff --git a/host/lib/utils/config_parser.cpp b/host/lib/utils/config_parser.cpp index dfd8d1b8b..c46671623 100644 --- a/host/lib/utils/config_parser.cpp +++ b/host/lib/utils/config_parser.cpp @@ -13,7 +13,7 @@ using namespace uhd; config_parser::config_parser(const std::string &path) { - if (not path.empty() and boost::filesystem::exists(path)) { + if (not path.empty()) { try { boost::property_tree::ini_parser::read_ini(path, _pt); } catch (const boost::property_tree::ini_parser_error &) { diff --git a/host/lib/utils/prefs.cpp b/host/lib/utils/prefs.cpp index ef920cf29..63479c911 100644 --- a/host/lib/utils/prefs.cpp +++ b/host/lib/utils/prefs.cpp @@ -23,13 +23,19 @@ namespace { config_parser& conf_file ) { if (not path.empty()) { - UHD_LOG_TRACE("PREFS", "Trying to load " << path); - try { - conf_file.read_file(path); - UHD_LOG_DEBUG("PREFS", - "Loaded " << config_type << " config file " << path); - } catch (...) { - // nop + UHD_LOG_TRACE("PREFS", "Trying to load " << path); + if (boost::filesystem::exists(path)) { + try { + conf_file.read_file(path); + UHD_LOG_DEBUG("PREFS", + "Loaded " << config_type << " config file " << path); + } catch (...) { + UHD_LOG_DEBUG("PREFS", + "Failed to load " << config_type << " config file " << path); + } + } else { + UHD_LOG_TRACE("PREFS", + "No " << config_type << " config file found at " << path); } } } -- cgit v1.2.3