@@ -510,30 +510,28 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
510510 ffStrbufAppendS (& profilePath , ".nix-profile" );
511511 if (ffPathExists (profilePath .chars , FF_PATHTYPE_DIRECTORY ))
512512 {
513- result -> nixUser = getNixPackages (& baseDir , ".nix-profile" );
513+ result -> nixUser + = getNixPackages (& baseDir , ".nix-profile" );
514514 }
515+
515516 // check if $XDG_STATE_HOME/nix/profile exists
517+ FF_STRBUF_AUTO_DESTROY stateDir = ffStrbufCreate ();
518+ const char * stateHome = getenv ("XDG_STATE_HOME" );
519+ if (ffStrSet (stateHome ))
520+ {
521+ ffStrbufSetS (& stateDir , stateHome );
522+ ffStrbufEnsureEndsWithC (& stateDir , '/' );
523+ }
516524 else
517525 {
518- FF_STRBUF_AUTO_DESTROY stateDir = ffStrbufCreate ();
519- const char * stateHome = getenv ("XDG_STATE_HOME" );
520- if (ffStrSet (stateHome ))
521- {
522- ffStrbufSetS (& stateDir , stateHome );
523- ffStrbufEnsureEndsWithC (& stateDir , '/' );
524- }
525- else
526- {
527- ffStrbufSet (& stateDir , & instance .state .platform .homeDir );
528- ffStrbufAppendS (& stateDir , ".local/state/" );
529- }
530-
531- ffStrbufSet (& profilePath , & stateDir );
532- ffStrbufAppendS (& profilePath , "nix/profile" );
533- result -> nixUser = getNixPackages (& stateDir , "nix/profile" );
526+ ffStrbufSet (& stateDir , & instance .state .platform .homeDir );
527+ ffStrbufAppendS (& stateDir , ".local/state/" );
534528 }
529+
530+ ffStrbufSet (& profilePath , & stateDir );
531+ ffStrbufAppendS (& profilePath , "nix/profile" );
532+ result -> nixUser += getNixPackages (& stateDir , "nix/profile" );
535533 }
536-
534+
537535 if (!(options -> disabled & FF_PACKAGES_FLAG_FLATPAK_BIT ))
538536 result -> flatpakUser = getFlatpak (& baseDir , "/.local/share/flatpak" );
539537}
0 commit comments