Skip to content

Commit

Permalink
Fixed loading configuration from $HOME/.config/
Browse files Browse the repository at this point in the history
  • Loading branch information
houmain committed Jun 16, 2022
1 parent 40c20ca commit 542b36d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <pwd.h>

namespace {
const auto system_config_path = "/etc/";
const auto system_config_path = std::filesystem::path("/etc/");
const auto update_interval = std::chrono::milliseconds(50);

Settings g_settings;
Expand Down Expand Up @@ -120,7 +120,7 @@ namespace {
}
}

const char* get_home_path() {
std::filesystem::path get_home_path() {
if (auto homedir = ::getenv("HOME"))
return homedir;
return ::getpwuid(::getuid())->pw_dir;
Expand All @@ -131,8 +131,8 @@ namespace {
auto error = std::error_code{ };
if (filename.empty()) {
filename = default_config_filename;
for (auto base : {
get_home_path(),
for (const auto& base : {
get_home_path() / ".config",
system_config_path
}) {
auto path = base / filename;
Expand Down

0 comments on commit 542b36d

Please sign in to comment.