@@ -89,19 +89,33 @@ void Config::setupConfig(Json::Value &dst, const std::string &config_file, int d
89
89
mergeConfig (dst, tmp_config);
90
90
}
91
91
92
+ std::optional<std::string> Config::findIncludePath (const std::string name) {
93
+ auto match1 = tryExpandPath (name, " " );
94
+ if (!match1.empty ()) {
95
+ return match1.front ();
96
+ }
97
+ return findConfigPath ({name});
98
+ }
99
+
92
100
void Config::resolveConfigIncludes (Json::Value &config, int depth) {
93
101
Json::Value includes = config[" include" ];
94
102
if (includes.isArray ()) {
95
103
for (const auto &include : includes) {
96
104
spdlog::info (" Including resource file: {}" , include.asString ());
97
- for (const auto &match : tryExpandPath (include.asString (), " " )) {
98
- setupConfig (config, match, depth + 1 );
105
+ auto match = findIncludePath (include.asString ());
106
+ if (match.has_value ()) {
107
+ setupConfig (config, match.value (), depth + 1 );
108
+ } else {
109
+ spdlog::warn (" Unable to find resource file: {}" , include.asString ());
99
110
}
100
111
}
101
112
} else if (includes.isString ()) {
102
113
spdlog::info (" Including resource file: {}" , includes.asString ());
103
- for (const auto &match : tryExpandPath (includes.asString (), " " )) {
104
- setupConfig (config, match, depth + 1 );
114
+ auto match = findIncludePath (includes.asString ());
115
+ if (match.has_value ()) {
116
+ setupConfig (config, match.value (), depth + 1 );
117
+ } else {
118
+ spdlog::warn (" Unable to find resource file: {}" , includes.asString ());
105
119
}
106
120
}
107
121
}
0 commit comments