fix(lib): fix Bedrock Linux not being detected

closes #17
This commit is contained in:
Adrian Groh 2023-03-16 12:58:17 +01:00
parent 9f8b035d43
commit 1a18897723
Signed by: Gobidev
GPG Key ID: 3AA3153E98B0D771

View File

@ -219,10 +219,20 @@ pub fn memory(memory_readout: &MemoryReadout) -> Option<String> {
pub fn os(general_readout: &GeneralReadout) -> Option<String> {
match env::consts::OS {
"linux" => match general_readout.distribution() {
Ok(distribution) => Some(distribution),
Err(_) => None,
},
"linux" => {
// check for Bedrock Linux
if dotenvy::var("PATH")
.unwrap_or_default()
.contains("/bedrock/cross/")
{
Some("Bedrock Linux".to_string())
} else {
match general_readout.distribution() {
Ok(distribution) => Some(distribution),
Err(_) => None,
}
}
}
_ => match general_readout.os_name() {
Ok(os) => Some(os),
Err(_) => None,