fix very silly error where versions weren't compared properly
This commit is contained in:
parent
9857c2d892
commit
25a07e8e7a
4 changed files with 7 additions and 5 deletions
|
@ -1 +1 @@
|
||||||
3
|
4
|
||||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -197,7 +197,7 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "curze"
|
name = "curze"
|
||||||
version = "0.3.2"
|
version = "0.3.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"home",
|
"home",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "curze"
|
name = "curze"
|
||||||
version = "0.3.3"
|
version = "0.3.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
|
@ -86,8 +86,10 @@ fn install_package(package: String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if Path::new(&format!("{}/.local/share/curze/{}.version", home, realised_name)).exists() {
|
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 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 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 = 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 {
|
if package_version == installed_version || installed_version > package_version {
|
||||||
println!("NOTE: No updates, installation halted.");
|
println!("NOTE: No updates, installation halted.");
|
||||||
return;
|
return;
|
||||||
|
|
Reference in a new issue