Skip to content

Commit 4909d69

Browse files
committed
Packages (Windows): don't rely on the existance of $SCOOP when detecting scoop packages
Fix #1868
1 parent fe76bbe commit 4909d69

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/detection/packages/packages_windows.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "packages.h"
22
#include "common/processing.h"
33
#include "util/stringUtils.h"
4+
#include "util/path.h"
45

56
#include <handleapi.h>
67
#include <fileapi.h>
@@ -37,10 +38,11 @@ static void detectScoop(FFPackagesResult* result)
3738
{
3839
FF_STRBUF_AUTO_DESTROY scoopPath = ffStrbufCreateA(MAX_PATH + 3);
3940

40-
const char* scoopEnv = getenv("SCOOP");
41-
if(ffStrSet(scoopEnv))
41+
if(ffFindExecutableInPath("scoop.cmd", &scoopPath) == NULL)
4242
{
43-
ffStrbufAppendS(&scoopPath, scoopEnv);
43+
// C:\Users\$USER\scoop\shims\scoop.cmd
44+
ffStrbufSubstrBeforeLastC(&scoopPath, '\\');
45+
ffStrbufSubstrBeforeLastC(&scoopPath, '\\');
4446
ffStrbufAppendS(&scoopPath, "/apps/*");
4547
}
4648
else

0 commit comments

Comments
 (0)