pub fn os_name(platform: &str, release: &str) -> String {
match platform {
"darwin" => {
if release
.split('.')
.next()
.and_then(|major| major.parse::<u32>().ok())
.is_some_and(|major| major > 15)
{
"macOS".to_string()
} else {
"OS X".to_string()
}
}
"linux" => "Linux".to_string(),
"win32" => "Windows".to_string(),
"freebsd" => "FreeBSD".to_string(),
"openbsd" => "OpenBSD".to_string(),
"sunos" => "Solaris".to_string(),
"android" => "Android".to_string(),
other => other.to_string(),
}
}
pub fn current_os_name() -> String {
os_name(std::env::consts::OS, "")
}