Bedrock linux detection

This commit is contained in:
Linus Dierheimer
2022-05-25 14:06:59 +02:00
parent afc144fa01
commit 102b2d33c7
+13 -1
View File
@@ -7,7 +7,7 @@
static void parseFile(const char* fileName, FFOSResult* result)
{
if(result->name.length > 0 && result->prettyName.length > 0)
if(result->id.length > 0 && result->name.length > 0 && result->prettyName.length > 0)
return;
ffParsePropFileValues(fileName, 13, (FFpropquery[]) {
@@ -124,6 +124,18 @@ const FFOSResult* ffDetectOS(const FFinstance* instance)
{
parseFile(instance->config.osFile.chars, &result);
}
else if(ffFileExists(FASTFETCH_TARGET_DIR_ROOT"/bedrock/etc/bedrock-release", S_IFDIR)) {
parseFile(FASTFETCH_TARGET_DIR_ROOT"/bedrock/etc/bedrock-release", &result);
if(result.id.length == 0)
ffStrbufAppendS(&result.id, "bedrock");
if(result.name.length == 0)
ffStrbufAppendS(&result.name, "Bedrock");
if(result.prettyName.length == 0)
ffStrbufAppendS(&result.prettyName, "Bedrock Linux");
}
else
{
parseFile(FASTFETCH_TARGET_DIR_ROOT"/etc/os-release", &result);