From 15b4bc45b2b0ccf2d93164b2b1b05fb94cc89220 Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Wed, 3 Apr 2024 05:11:59 +0800 Subject: 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 --- Settings.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Settings.c b/Settings.c index f9a58e37..e2c94e2b 100644 --- a/Settings.c +++ b/Settings.c @@ -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 @@ -849,9 +849,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; -- cgit v1.2.3