diff options
author | Explorer09 <explorer09@gmail.com> | 2024-04-03 05:11:59 +0800 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2024-04-05 19:26:38 +0200 |
commit | 15b4bc45b2b0ccf2d93164b2b1b05fb94cc89220 (patch) | |
tree | 3a22db8b52b7639b31ba3913d3d721bb262948ef | |
parent | 58c1cb0204281e2d16ed83464ad1bc37ae7b4de8 (diff) |
Read htoprc in modern location first before old one
Read htop configuration file in the modern location first
("~/.config/htop/htoprc") before trying the legacy location
("~/.htoprc"). This would prevent a case where configuration files exist
in both locations and the new configuration gets replaced by the old
one.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
-rw-r--r-- | Settings.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -838,8 +838,8 @@ Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicMeters, H #endif this->changed = false; this->delay = DEFAULT_DELAY; - bool ok = false; - if (legacyDotfile) { + bool ok = Settings_read(this, this->filename, initialCpuCount); + if (!ok && legacyDotfile) { ok = Settings_read(this, legacyDotfile, initialCpuCount); if (ok) { // Transition to new location and delete old configuration file @@ -850,9 +850,6 @@ Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicMeters, H free(legacyDotfile); } if (!ok) { - ok = Settings_read(this, this->filename, initialCpuCount); - } - if (!ok) { this->screenTabs = true; this->changed = true; ok = Settings_read(this, SYSCONFDIR "/htoprc", initialCpuCount); |