@@ -472,31 +472,27 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
472472
473473 if (parseJsoncFile (value )) return ;
474474
475- //Try to load as a relative path
476-
477475 FF_STRBUF_AUTO_DESTROY absolutePath = ffStrbufCreateA (128 );
478- FF_LIST_FOR_EACH (FFstrbuf , path , instance .state .platform .dataDirs )
476+
477+ //Try to load as a relative path with the directory of fastfetch binary
478+ if (instance .state .platform .exePath .length )
479479 {
480- //We need to copy it, because if a config file loads a config file, the value of path must be unchanged
481- ffStrbufSet (& absolutePath , path );
482- ffStrbufAppendS (& absolutePath , "fastfetch/presets /" );
480+ ffStrbufSet ( & absolutePath , & instance . state . platform . exePath );
481+ ffStrbufSubstrBeforeLastC (& absolutePath , '/' );
482+ ffStrbufAppendS (& absolutePath , "/" );
483483 ffStrbufAppendS (& absolutePath , value );
484484
485- bool success = parseJsoncFile (absolutePath .chars );
486- if (!success )
487- {
488- ffStrbufAppendS (& absolutePath , ".jsonc" );
489- success = parseJsoncFile (absolutePath .chars );
490- }
491-
492- if (success ) return ;
485+ if (parseJsoncFile (absolutePath .chars )) return ;
486+ ffStrbufClear (& absolutePath );
493487 }
494488
489+ //Try to load as a relative path
490+
491+ FF_LIST_FOR_EACH (FFstrbuf , path , instance .state .platform .dataDirs )
495492 {
496- //Try exe path
497- ffStrbufSet (& absolutePath , & instance .state .platform .exePath );
498- ffStrbufSubstrBeforeLastC (& absolutePath , '/' );
499- ffStrbufAppendS (& absolutePath , "/presets/" );
493+ //We need to copy it, because if a config file loads a config file, the value of path must be unchanged
494+ ffStrbufSet (& absolutePath , path );
495+ ffStrbufAppendS (& absolutePath , "fastfetch/presets/" );
500496 ffStrbufAppendS (& absolutePath , value );
501497
502498 bool success = parseJsoncFile (absolutePath .chars );
0 commit comments