fix very silly error where versions weren't compared properly

This commit is contained in:
abbie 2023-08-10 12:39:10 +01:00
parent 9857c2d892
commit 25a07e8e7a
Signed by: threeoh6000
GPG key ID: 801FE4AD456E922C
4 changed files with 7 additions and 5 deletions

View file

@ -1 +1 @@
3
4

2
Cargo.lock generated
View file

@ -197,7 +197,7 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
name = "curze"
version = "0.3.2"
version = "0.3.3"
dependencies = [
"clap",
"home",

View file

@ -1,6 +1,6 @@
[package]
name = "curze"
version = "0.3.3"
version = "0.3.4"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -86,8 +86,10 @@ fn install_package(package: String) {
}
if Path::new(&format!("{}/.local/share/curze/{}.version", home, realised_name)).exists() {
let package_version = fs::read_to_string(format!("{}/.local/share/curze/cache/{}/.curze/version", home, realised_name)).unwrap_or("4294967295".to_string()).parse::<u32>().unwrap_or(4294967295);
let installed_version = fs::read_to_string(format!("{}/.local/share/curze/{}.version", home, realised_name)).unwrap_or("4294967295".to_string()).parse::<u32>().unwrap_or(4294967295);
let package_version_a = fs::read_to_string(format!("{}/.local/share/curze/cache/{}/.curze/version", home, realised_name)).unwrap_or("4294967295".to_string()).replace("\n","").replace("\r\n","");
let package_version = package_version_a.parse::<u32>().unwrap_or(0);
let installed_version_a = fs::read_to_string(format!("{}/.local/share/curze/{}.version", home, realised_name)).unwrap_or("4294967295".to_string()).replace("\n","").replace("\r\n","");
let installed_version = installed_version_a.parse::<u32>().unwrap_or(0);
if package_version == installed_version || installed_version > package_version {
println!("NOTE: No updates, installation halted.");
return;