Fastfetch: enhances config file loading with support for config directory

Fixes #2080
This commit is contained in:
李通洲
2025-12-05 10:30:51 +08:00
parent d6ac89ea8d
commit 8652737f64
2 changed files with 17 additions and 2 deletions
+2
View File
@@ -1,6 +1,8 @@
# 2.56.0
Features:
* Enhances config file loading. `--config` and `-c` with relative path now also searches paths defined in `fastfetch --list-config-paths` (typically `~/.config/fastfetch/`)
* This allows users to use `fastfetch -c my-config` without needing to specify the full path.
* Adds NUMA node count detection (CPU)
* Exposed via `{numa-nodes}` in custom format
* Supported on Linux, FreeBSD and Windows
+15 -2
View File
@@ -502,7 +502,20 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
if (parseJsoncFile(absolutePath.chars, flag)) return;
//Try to load as a relative path
//Try to load as a relative path with the config directory
FF_LIST_FOR_EACH(FFstrbuf, path, instance.state.platform.configDirs)
{
ffStrbufSet(&absolutePath, path);
ffStrbufAppendS(&absolutePath, "fastfetch/");
ffStrbufAppendS(&absolutePath, value);
if (needExtension)
ffStrbufAppendS(&absolutePath, ".jsonc");
if (parseJsoncFile(absolutePath.chars, flag)) return;
}
//Try to load as a preset
FF_LIST_FOR_EACH(FFstrbuf, path, instance.state.platform.dataDirs)
{
@@ -515,7 +528,7 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
if (parseJsoncFile(absolutePath.chars, flag)) return;
}
//Try to load as a relative path with the directory of fastfetch binary
//Try to load as a relative path with the directory of fastfetch binary, for Windows support
if (instance.state.platform.exePath.length)
{