From fee2044aeed41856c48e1845f400b95a93313132 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2024 21:16:22 +0200 Subject: chore: bump libthermite from 0.7.1 to 0.8.1 in /src-tauri (#954) * chore: bump libthermite from 0.7.1 to 0.8.1 in /src-tauri Bumps libthermite from 0.7.1 to 0.8.1. --- updated-dependencies: - dependency-name: libthermite dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * fix: Adjust logic for new libthermite release Not the nicest implementation but does the trick --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GeckoEidechse --- src-tauri/Cargo.lock | 4 ++-- src-tauri/Cargo.toml | 2 +- src-tauri/src/mod_management/mod.rs | 26 +++++++++++++++++++------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2b7413c8..0f0a2219 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2314,9 +2314,9 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libthermite" -version = "0.7.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c4f076e602c8aa9ec99cd8b2d23cdf1606c27e5f04cba13aa61bdc50e678ee8" +checksum = "c27ac02c14161a4b0db739b37618d929d7f2af320c1f993e3d674599f77b79e7" dependencies = [ "flate2", "json5", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0f7e0e34..36761d70 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -33,7 +33,7 @@ steamlocate = "2.0.0-beta.2" # Error messages anyhow = "1.0" # libthermite for Northstar/mod install handling -libthermite = { version = "0.7.1", features = ["proton"] } +libthermite = { version = "0.8.1", features = ["proton"] } # zip stuff zip = "0.6.2" # Regex diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs index d5b5214e..ebbcf431 100644 --- a/src-tauri/src/mod_management/mod.rs +++ b/src-tauri/src/mod_management/mod.rs @@ -7,6 +7,7 @@ use thermite::prelude::ThermiteError; use crate::NorthstarMod; use anyhow::{anyhow, Result}; use serde::{Deserialize, Serialize}; +use std::error::Error; use std::str::FromStr; use std::string::ToString; use std::{fs, path::PathBuf}; @@ -505,10 +506,14 @@ fn delete_older_versions( /// Checks whether some mod is correctly formatted /// Currently checks whether /// - Some `mod.json` exists under `mods/*/mod.json` -fn fc_sanity_check(input: &&fs::File) -> bool { +fn fc_sanity_check(input: &&fs::File) -> Result<(), Box> { let mut archive = match zip::read::ZipArchive::new(*input) { Ok(archive) => archive, - Err(_) => return false, + Err(_) => { + return Err(Box::new(ThermiteError::UnknownError( + "Failed reading zip file".into(), + ))) + } }; let mut has_mods = false; @@ -538,14 +543,22 @@ fn fc_sanity_check(input: &&fs::File) -> bool { if name.to_str().unwrap().contains(".dll") { log::warn!("Plugin detected, prompting user"); if !plugins::plugin_prompt() { - return false; // Plugin detected and user denied install + return Err(Box::new(ThermiteError::UnknownError( + "Plugin detected and install denied".into(), + ))); } } } } } - has_mods && mod_json_exists + if has_mods && mod_json_exists { + Ok(()) + } else { + Err(Box::new(ThermiteError::UnknownError( + "Mod not correctly formatted".into(), + ))) + } } // Copied from `libtermite` source code and modified @@ -643,9 +656,8 @@ pub async fn fc_download_mod_and_install( Err(err) => { log::warn!("libthermite couldn't install mod {thunderstore_mod_string} due to {err:?}",); return match err { - ThermiteError::SanityError => Err( - "Mod failed sanity check during install. It's probably not correctly formatted" - .to_string(), + ThermiteError::SanityError(e) => Err( + format!("Mod failed sanity check during install. It's probably not correctly formatted. {}", e) ), _ => Err(err.to_string()), }; -- cgit v1.2.3