From 1f16d7955d7832e2fcdc3317d42034ac0c772dac Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Fri, 13 Aug 2021 08:19:12 -0700 Subject: [PATCH] refactor(config): drop getValidPath --- src/config.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index ed7168dc..207e1bd1 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -33,16 +33,6 @@ std::optional tryExpandPath(const std::string &path) { return std::nullopt; } -const std::string getValidPath(const std::vector &paths) { - for (const std::string &path : paths) { - if (auto res = tryExpandPath(path); res) { - return res.value(); - } - } - - return std::string(); -} - std::optional Config::findConfigPath(const std::vector &names, const std::vector &dirs) { std::vector paths; @@ -82,11 +72,11 @@ void Config::resolveConfigIncludes(Json::Value &config, int depth) { if (includes.isArray()) { for (const auto &include : includes) { spdlog::info("Including resource file: {}", include.asString()); - setupConfig(getValidPath({include.asString()}), ++depth); + setupConfig(tryExpandPath(include.asString()).value_or(""), ++depth); } } else if (includes.isString()) { spdlog::info("Including resource file: {}", includes.asString()); - setupConfig(getValidPath({includes.asString()}), ++depth); + setupConfig(tryExpandPath(includes.asString()).value_or(""), ++depth); } }