@@ -17,10 +17,10 @@ static uint32_t getNumElements(const char* searchPath /* including `\*` suffix *
1717 counter ++ ;
1818 } while (FindNextFileA (hFind , & wfd ));
1919 FindClose (hFind );
20- }
2120
22- if (type == FILE_ATTRIBUTE_DIRECTORY && counter >= 2 )
23- counter -= 2 ; // accounting for . and ..
21+ if (type == FILE_ATTRIBUTE_DIRECTORY && counter >= 2 )
22+ counter -= 2 ; // accounting for . and ..
23+ }
2424
2525 return counter ;
2626}
@@ -35,10 +35,8 @@ static void detectScoop(const FFinstance* instance, FFPackagesResult* result)
3535 result -> scoop -- ; // scoop
3636}
3737
38- static void detectChoco (const FFinstance * instance , FFPackagesResult * result )
38+ static void detectChoco (FF_MAYBE_UNUSED const FFinstance * instance , FFPackagesResult * result )
3939{
40- FF_UNUSED (instance );
41-
4240 const char * chocoInstall = getenv ("ChocolateyInstall" );
4341 if (!chocoInstall || chocoInstall [0 ] == '\0' )
4442 return ;
@@ -51,8 +49,22 @@ static void detectChoco(const FFinstance* instance, FFPackagesResult* result)
5149 result -> choco -- ; // choco
5250}
5351
52+ static void detectPacman (FF_MAYBE_UNUSED const FFinstance * instance , FFPackagesResult * result )
53+ {
54+ const char * msystemPrefix = getenv ("MSYSTEM_PREFIX" );
55+ if (!msystemPrefix )
56+ return ;
57+
58+ // MSYS2
59+ char pacmanPath [MAX_PATH + 3 ];
60+ strcpy (pacmanPath , msystemPrefix );
61+ strncat (pacmanPath , "/../var/lib/pacman/local/*" , sizeof (pacmanPath ) - 1 - strlen (pacmanPath ));
62+ result -> pacman = getNumElements (pacmanPath , FILE_ATTRIBUTE_DIRECTORY );
63+ }
64+
5465void ffDetectPackagesImpl (const FFinstance * instance , FFPackagesResult * result )
5566{
5667 detectScoop (instance , result );
5768 detectChoco (instance , result );
69+ detectPacman (instance , result );
5870}
0 commit comments