@@ -466,38 +466,31 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
466466
467467 if (parseJsoncFile (absolutePath .chars , strictJson )) return ;
468468
469- if (!ffStrbufContainC (& absolutePath , '/' )
470- #ifdef _WIN32
471- && !ffStrbufContainC (& absolutePath , '\\' )
472- #endif
473- )
469+ //Try to load as a relative path
470+
471+ FF_LIST_FOR_EACH (FFstrbuf , path , instance .state .platform .dataDirs )
474472 {
475- //Try to load as a relative path
473+ ffStrbufSet (& absolutePath , path );
474+ ffStrbufAppendS (& absolutePath , "fastfetch/presets/" );
475+ ffStrbufAppendS (& absolutePath , value );
476+ if (needExtension )
477+ ffStrbufAppendS (& absolutePath , ".jsonc" );
476478
477- FF_LIST_FOR_EACH (FFstrbuf , path , instance .state .platform .dataDirs )
478- {
479- ffStrbufSet (& absolutePath , path );
480- ffStrbufAppendS (& absolutePath , "fastfetch/presets/" );
481- ffStrbufAppendS (& absolutePath , value );
482- if (needExtension )
483- ffStrbufAppendS (& absolutePath , ".jsonc" );
479+ if (parseJsoncFile (absolutePath .chars , strictJson )) return ;
480+ }
484481
485- if (parseJsoncFile (absolutePath .chars , strictJson )) return ;
486- }
482+ //Try to load as a relative path with the directory of fastfetch binary
487483
488- //Try to load as a relative path with the directory of fastfetch binary
484+ if (instance .state .platform .exePath .length )
485+ {
486+ ffStrbufSet (& absolutePath , & instance .state .platform .exePath );
487+ ffStrbufSubstrBeforeLastC (& absolutePath , '/' );
488+ ffStrbufAppendS (& absolutePath , "/" );
489+ ffStrbufAppendS (& absolutePath , value );
490+ if (needExtension )
491+ ffStrbufAppendS (& absolutePath , ".jsonc" );
489492
490- if (instance .state .platform .exePath .length )
491- {
492- ffStrbufSet (& absolutePath , & instance .state .platform .exePath );
493- ffStrbufSubstrBeforeLastC (& absolutePath , '/' );
494- ffStrbufAppendS (& absolutePath , "/" );
495- ffStrbufAppendS (& absolutePath , value );
496- if (needExtension )
497- ffStrbufAppendS (& absolutePath , ".jsonc" );
498-
499- if (parseJsoncFile (absolutePath .chars , strictJson )) return ;
500- }
493+ if (parseJsoncFile (absolutePath .chars , strictJson )) return ;
501494 }
502495
503496 //File not found
0 commit comments