Library for detecting the operating system type and version.
Based on os_type by Jan Schulte. The main difference of os_info
is that this library separates completely incompatible operating systems by conditional compilation.
To use this crate, add os_info
as a dependency to your project's Cargo.toml:
toml
[dependencies]
os_info = "0.1.0"
```rust extern crate os_info;
let os = osinfo::currentplatform(); println!("Type: {:?}", os.os_type); println!("Version: {}", os.version); ```
Right now, the following operating system types can be returned: - Unknown - Redhat - CentOS - OSX - Ubuntu - Debian - Arch
If you need support for more OS types, I am looking forward to your Pull Request.
On Linux based systems this library requires that lsb_release is installed.
os_info
is licensed under the MIT license. See LICENSE for the details.