File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -191,14 +191,19 @@ static const char* getWslg(FFstrbuf* result) {
191191 return "Failed to read /mnt/wslg/versions.txt" ;
192192 }
193193
194- if (!ffStrbufStartsWithS (result , "WSLg " )) {
195- return "Failed to find WSLg version" ;
194+ if (ffStrbufStartsWithS (result , "WSLg: " )) { // WSL 2.9.3+
195+ ffStrbufSubstrBeforeFirstC (result , '\n' );
196+ ffStrbufSubstrAfter (result , (uint32_t ) (strlen ("WSLg: " ) - 1 ));
197+ } else if (ffStrbufStartsWithS (result , "WSLg " )) {
198+ ffStrbufSubstrBeforeFirstC (result , '\n' );
199+ ffStrbufSubstrBeforeFirstC (result , '+' );
200+ ffStrbufSubstrAfterFirstC (result , ':' );
201+ ffStrbufTrimLeft (result , ' ' );
202+ } else {
203+ ffStrbufClear (result );
204+ return "Failed to parse WSLg version from /mnt/wslg/versions.txt" ;
196205 }
197206
198- ffStrbufSubstrBeforeFirstC (result , '\n' );
199- ffStrbufSubstrBeforeFirstC (result , '+' );
200- ffStrbufSubstrAfterFirstC (result , ':' );
201- ffStrbufTrimLeft (result , ' ' );
202207 return NULL ;
203208}
204209 #endif
You can’t perform that action at this time.
0 commit comments