configuration: support multiple configuration files

This commit is contained in:
Andrzej Rybczak
2014-11-15 15:07:49 +01:00
parent 8745523170
commit 38d9f811de
8 changed files with 61 additions and 18 deletions

View File

@@ -173,7 +173,7 @@ option_parser::worker buffer(NC::Buffer &arg, ValueT &&value, TransformT &&map)
}
bool Configuration::read(const std::string &config_path)
bool Configuration::read(const std::vector<std::string> &config_paths)
{
std::string mpd_host;
unsigned mpd_port;
@@ -653,8 +653,16 @@ bool Configuration::read(const std::string &config_path)
active_window_border, NC::Border::Red
));
std::ifstream f(config_path);
return p.run(f);
return std::all_of(
config_paths.begin(),
config_paths.end(),
[&p](const std::string &config_path) {
std::ifstream f(config_path);
if (f.is_open())
std::clog << "Reading configuration from " << config_path << "...\n";
return p.run(f);
}
);
}
/* vim: set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab : */