diff --git a/Cargo.lock b/Cargo.lock index 72aac97..1efc0b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5771,6 +5771,7 @@ dependencies = [ "remotefs-webdav", "rpassword", "self_update", + "semver", "serde", "serial_test", "shellexpand", @@ -5786,7 +5787,6 @@ dependencies = [ "unicode-width 0.2.0", "uzers", "vergen-git2", - "version-compare", "whoami", "wildmatch", ] @@ -6440,12 +6440,6 @@ dependencies = [ "rustversion", ] -[[package]] -name = "version-compare" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" - [[package]] name = "version_check" version = "0.9.5" diff --git a/Cargo.toml b/Cargo.toml index 71f3370..6b0e983 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,6 +77,7 @@ self_update = { version = "0.42", default-features = false, features = [ "compression-zip-deflate", "rustls", ] } +semver = "1" serde = { version = "1", features = ["derive"] } shellexpand = "3" simplelog = "0.12" @@ -89,7 +90,6 @@ tui-realm-stdlib = "3" tui-term = "0.2" tuirealm = "3" unicode-width = "0.2" -version-compare = "0.2" whoami = "2" wildmatch = "2" diff --git a/src/system/auto_update.rs b/src/system/auto_update.rs index b0afd47..d01ad3e 100644 --- a/src/system/auto_update.rs +++ b/src/system/auto_update.rs @@ -132,8 +132,13 @@ impl Update { /// Check wether new version is higher than new version fn is_new_version_higher(new_version: &str, current_version: &str) -> bool { - version_compare::compare(new_version, current_version).unwrap_or(version_compare::Cmp::Lt) - == version_compare::Cmp::Gt + match ( + semver::Version::parse(new_version), + semver::Version::parse(current_version), + ) { + (Ok(new), Ok(current)) => new > current, + _ => false, + } } } impl From for UpdateStatus {