mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Fix config files loading other config files
This commit is contained in:
+10
-7
@@ -651,21 +651,24 @@ static void optionParseConfigFile(FFinstance* instance, FFdata* data, const char
|
||||
|
||||
//Try to load as a relative path
|
||||
|
||||
FFstrbuf absolutePath;
|
||||
ffStrbufInitA(&absolutePath, 128);
|
||||
|
||||
FF_LIST_FOR_EACH(FFstrbuf, path, instance->state.platform.dataDirs)
|
||||
{
|
||||
uint32_t pathLength = path->length;
|
||||
//We need to copy it, because if a config file loads a config file, the value of path must be unchanged
|
||||
ffStrbufSet(&absolutePath, path);
|
||||
ffStrbufAppendS(&absolutePath, "fastfetch/presets/");
|
||||
ffStrbufAppendS(&absolutePath, value);
|
||||
|
||||
ffStrbufAppendS(path, "fastfetch/presets/");
|
||||
ffStrbufAppendS(path, value);
|
||||
|
||||
bool success = parseConfigFile(instance, data, path->chars);
|
||||
|
||||
ffStrbufSubstrBefore(path, pathLength);
|
||||
bool success = parseConfigFile(instance, data, absolutePath.chars);
|
||||
|
||||
if(success)
|
||||
return;
|
||||
}
|
||||
|
||||
ffStrbufDestroy(&absolutePath);
|
||||
|
||||
//File not found
|
||||
|
||||
fprintf(stderr, "Error: couldn't find config: %s\n", value);
|
||||
|
||||
Reference in New Issue
Block a user