Packages (Windows): don't rely on the existance of $SCOOP when detecting scoop packages

Fix #1868
This commit is contained in:
李通洲
2025-07-28 23:41:48 +08:00
parent fe76bbe68a
commit 4909d693e3
+5 -3
View File
@@ -1,6 +1,7 @@
#include "packages.h"
#include "common/processing.h"
#include "util/stringUtils.h"
#include "util/path.h"
#include <handleapi.h>
#include <fileapi.h>
@@ -37,10 +38,11 @@ static void detectScoop(FFPackagesResult* result)
{
FF_STRBUF_AUTO_DESTROY scoopPath = ffStrbufCreateA(MAX_PATH + 3);
const char* scoopEnv = getenv("SCOOP");
if(ffStrSet(scoopEnv))
if(ffFindExecutableInPath("scoop.cmd", &scoopPath) == NULL)
{
ffStrbufAppendS(&scoopPath, scoopEnv);
// C:\Users\$USER\scoop\shims\scoop.cmd
ffStrbufSubstrBeforeLastC(&scoopPath, '\\');
ffStrbufSubstrBeforeLastC(&scoopPath, '\\');
ffStrbufAppendS(&scoopPath, "/apps/*");
}
else