Host (WSL): make WSL version the product version

This commit is contained in:
李通洲
2023-06-22 14:58:07 +08:00
parent 1ad204e0a1
commit e261bf8be0
+2 -3
View File
@@ -86,6 +86,7 @@ const char* ffDetectHost(FFHostResult* host)
if(getenv("WSL_DISTRO") != NULL || getenv("WSL_INTEROP") != NULL)
{
ffStrbufAppendS(&host->productName, "Windows Subsystem for Linux");
ffStrbufAppendS(&host->productFamily, "WSL");
FF_STRBUF_AUTO_DESTROY wslVer = ffStrbufCreate(); //Wide charactors
if(!ffProcessAppendStdOut(&wslVer, (char* const[]){
@@ -96,12 +97,10 @@ const char* ffDetectHost(FFHostResult* host)
{
ffStrbufSubstrBeforeFirstC(&wslVer, '\r'); //CRLF
ffStrbufSubstrAfterLastC(&wslVer, ' ');
ffStrbufAppendS(&host->productName, " (");
for(uint32_t i = 0; i < wslVer.length; ++i) {
if(wslVer.chars[i]) //don't append \0
ffStrbufAppendC(&host->productName, wslVer.chars[i]);
ffStrbufAppendC(&host->productVersion, wslVer.chars[i]);
}
ffStrbufAppendC(&host->productName, ')');
}
}
}