Windows: add basic support for msys2

This commit is contained in:
李通洲
2022-10-02 17:52:09 +08:00
parent 145e09d164
commit eaa4230bf5
8 changed files with 52 additions and 19 deletions
+1
View File
@@ -6,6 +6,7 @@
#include "fastfetch.h"
#define FF_HOST_PRODUCT_NAME_WSL "Windows Subsystem for Linux"
#define FF_HOST_PRODUCT_NAME_MSYS "Windows on MSYS"
typedef struct FFHostResult
{
+8 -6
View File
@@ -109,10 +109,12 @@ void ffDetectHostImpl(FFHostResult* host)
if(ffStrbufStartsWithS(&host->productName, "Standard PC"))
ffStrbufPrependS(&host->productName, "KVM/QEMU ");
//On WSL, the real host can't be detected. Instead use WSL as host.
if(host->productFamily.length == 0 && host->productName.length == 0 && (
getenv("WSLENV") != NULL ||
getenv("WSL_DISTRO") != NULL ||
getenv("WSL_INTEROP") != NULL
)) ffStrbufAppendS(&host->productName, FF_HOST_PRODUCT_NAME_WSL);
if(host->productFamily.length == 0 && host->productName.length == 0)
{
//On WSL, the real host can't be detected. Instead use WSL as host.
if(getenv("WSL_DISTRO") != NULL || getenv("WSL_INTEROP") != NULL)
ffStrbufAppendS(&host->productName, FF_HOST_PRODUCT_NAME_WSL);
else if(getenv("MSYSTEM") != NULL && strcmp(getenv("MSYSTEM"), "MSYS") == 0)
ffStrbufAppendS(&host->productName, FF_HOST_PRODUCT_NAME_MSYS);
}
}