From 3e57468a3fa5434a7f0da7e645b0e4b51a47a886 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Thu, 28 Sep 2023 17:38:17 +0200 Subject: [PATCH] feat: Added 7z dependency requirement --- src/main.rs | 4 ++-- src/ui/first_run/dependencies.rs | 18 +++++++++++++++--- src/ui/first_run/welcome.rs | 7 ++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index d81100a..eb8b96d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -98,10 +98,10 @@ fn main() -> anyhow::Result<()> { // Run the game let mut run_game = false; - // Forcely run the game + // Force run the game let mut just_run_game = false; - // Forcely disable verbode tracing output in stdout + // Force disable verbose tracing output in stdout let mut no_verbose_tracing = false; let args = std::env::args().collect::>(); diff --git a/src/ui/first_run/dependencies.rs b/src/ui/first_run/dependencies.rs index c51db17..5c4a979 100644 --- a/src/ui/first_run/dependencies.rs +++ b/src/ui/first_run/dependencies.rs @@ -69,7 +69,7 @@ impl SimpleAsyncComponent for DependenciesApp { }, gtk::Entry { - set_text: "sudo pacman -Syu git xdelta3", + set_text: "sudo pacman -Syu git xdelta3 p7zip", set_editable: false } }, @@ -86,7 +86,7 @@ impl SimpleAsyncComponent for DependenciesApp { }, gtk::Entry { - set_text: "sudo apt install git xdelta3", + set_text: "sudo apt install git xdelta3 p7zip-full", set_editable: false } }, @@ -103,7 +103,7 @@ impl SimpleAsyncComponent for DependenciesApp { }, gtk::Entry { - set_text: "sudo dnf install git xdelta", + set_text: "sudo dnf install git xdelta p7zip", set_editable: false } } @@ -185,6 +185,18 @@ impl SimpleAsyncComponent for DependenciesApp { } } + // 7z sometimes has different binaries + if !is_available("7z") && !is_available("7za") { + sender.output(Self::Output::Toast { + title: tr!("package-not-available", { + "package" = "7z" + }), + description: None + }); + + return; + } + sender.output(Self::Output::ScrollToDefaultPaths); } diff --git a/src/ui/first_run/welcome.rs b/src/ui/first_run/welcome.rs index 8f4fce0..3bb7e8c 100644 --- a/src/ui/first_run/welcome.rs +++ b/src/ui/first_run/welcome.rs @@ -85,7 +85,12 @@ impl SimpleAsyncComponent for WelcomeApp { match msg { #[allow(unused_must_use)] WelcomeAppMsg::Continue => { - if is_available("git") && is_available("xdelta3") { + let installed = + is_available("git") && + is_available("xdelta3") && + (is_available("7z") || is_available("7za")); + + if installed { sender.output(Self::Output::ScrollToDefaultPaths); } else { sender.output(Self::Output::ScrollToDependencies);