From 69cf83d3bc9acfee33bb58956522087808ff7dbd Mon Sep 17 00:00:00 2001 From: jackun Date: Thu, 13 Feb 2020 15:19:42 +0200 Subject: [PATCH] config file: print that config file is skipped if we failed to open it --- src/config.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 54bedc0c..7450f9f1 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -46,7 +46,7 @@ void parseConfigFile() { home = env_home; if (!home.empty()) { paths.push_back(home + "/.local/share/MangoHud/MangoHud.conf"); - paths.push_back(home + config_dir + "/MangoHud.conf"); + paths.push_back(home + config_dir + "MangoHud.conf"); } std::string exe_path = get_exe_path(); @@ -83,8 +83,14 @@ void parseConfigFile() { std::string line; for (auto& p : paths) { - std::cerr << "parsing config: " << p; std::ifstream stream(p); + if (!stream.good()) { + // printing just so user has an idea of possible configs + std::cerr << "skipping config: " << p << std::endl; + continue; + } + + std::cerr << "parsing config: " << p; while (std::getline(stream, line)) { parseConfigLine(line);