Crates.io | platform-lp |
lib.rs | platform-lp |
version | 0.2.2 |
source | src |
created_at | 2018-12-14 15:13:20.725966 |
updated_at | 2018-12-22 19:11:49.926259 |
description | a library for getting the user platform, and checking against other platforms |
homepage | |
repository | https://github.com/snsvrno/platform-lp-rs |
max_upload_size | |
id | 101892 |
size | 17,103 |
A platform enum written in rust to be used with lovepack tools.
Contains functions to determine the current running platform as well as parsing and comparisons.
Include the library in your cargo.toml
.
[dependencies]
platform-lp = "0.2"
Then use it in your library / application.
let user_plat = platform_lp::Platform::get_user_platform();
// you can pass an entire executable name to check what platform it is,
// assuming it goes by some kind of standard naming convention.
// like perhaps one of mine: lpsettings-0.1.7-win-x86_64.zip
let package_platform = platform_lp::Platform::new(executable_release_name);
// then you can check if its the same platform
if user_plat == package_platform {
// then extract it, run it, etc ...
}
// or you can check compatability (i.e. for 32 bit on 64 bit systems)
if package_platform.is_compatible(user_plat) {
// then do something fun...
}
std::fmt::Display