Prefer $XDG_CONFIG_HOME/ncmpcpp as a folder with configuration

This commit is contained in:
Andrzej Rybczak
2020-12-20 17:20:41 +01:00
parent 451856afd3
commit 31798fd1c7
7 changed files with 26 additions and 15 deletions

View File

@@ -74,13 +74,13 @@ void expand_home(std::string &path)
bool configure(int argc, char **argv)
{
const std::vector<std::string> default_config_paths = {
"~/.ncmpcpp/config",
xdg_config_home() + "ncmpcpp/config"
xdg_config_home() + "ncmpcpp/config",
"~/.ncmpcpp/config"
};
const std::vector<std::string> default_bindings_paths = {
"~/.ncmpcpp/bindings",
xdg_config_home() + "ncmpcpp/bindings"
xdg_config_home() + "ncmpcpp/bindings",
"~/.ncmpcpp/bindings"
};
std::vector<std::string> bindings_paths;

View File

@@ -103,7 +103,7 @@ int main(int argc, char **argv)
// always execute these commands, even if ncmpcpp use exit function
atexit(do_at_exit);
// redirect std::cerr output to ~/.ncmpcpp/error.log file
// redirect std::cerr output to the error.log file
errorlog.open((Config.ncmpcpp_directory + "error.log").c_str(), std::ios::app);
cerr_buffer = std::cerr.rdbuf();
std::cerr.rdbuf(errorlog.rdbuf());

View File

@@ -235,7 +235,7 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
});
// keep the same order of variables as in configuration file
p.add("ncmpcpp_directory", &ncmpcpp_directory, "~/.ncmpcpp/", adjust_directory);
p.add("ncmpcpp_directory", &ncmpcpp_directory, "~/.config/ncmpcpp/", adjust_directory);
p.add("lyrics_directory", &lyrics_directory, "~/.lyrics/", adjust_directory);
p.add<void>("mpd_host", nullptr, "localhost", [](std::string host) {
expand_home(host);