fix identification of Darwin-based systems
This commit is contained in:
parent
bef621f04f
commit
43174e5ba7
19
src/main.rs
19
src/main.rs
@ -111,10 +111,25 @@ impl Information {
|
|||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
let mut sys = System::new_all();
|
let mut sys = System::new_all();
|
||||||
sys.refresh_all();
|
sys.refresh_all();
|
||||||
|
|
||||||
|
let mut os_name = sys.name();
|
||||||
|
|
||||||
|
// Get full OS name for Darwin-based systems (i.e. macOS, iOS).
|
||||||
|
if os_name == Some("Darwin".to_string()) {
|
||||||
|
let long_os = sys.long_os_version();
|
||||||
|
if long_os.is_some() {
|
||||||
|
// Isolate system type from version information.
|
||||||
|
let long_os_split =
|
||||||
|
long_os.unwrap().split_whitespace().collect::<Vec<&str>>()[0].to_string();
|
||||||
|
|
||||||
|
os_name = Some(long_os_split);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
username: whoami::username(),
|
username: whoami::username(),
|
||||||
hostname: whoami::hostname(),
|
hostname: whoami::hostname(),
|
||||||
os_name: sys.name(),
|
os_name,
|
||||||
os_ver: sys.os_version(),
|
os_ver: sys.os_version(),
|
||||||
kernel_ver: sys.kernel_version(),
|
kernel_ver: sys.kernel_version(),
|
||||||
uptime: compound_duration::format_dhms(sys.uptime()),
|
uptime: compound_duration::format_dhms(sys.uptime()),
|
||||||
@ -225,7 +240,7 @@ impl Information {
|
|||||||
"Windows" => '',
|
"Windows" => '',
|
||||||
"Android" => '',
|
"Android" => '',
|
||||||
"iOS" => '',
|
"iOS" => '',
|
||||||
"macOS" => '',
|
"MacOS" => '',
|
||||||
"Unknown System" => '?',
|
"Unknown System" => '?',
|
||||||
_ => {
|
_ => {
|
||||||
if sys
|
if sys
|
||||||
|
Loading…
Reference in New Issue
Block a user