From 6fd220e6337f32ec45d49118c974f54aad34a500 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Sun, 18 Sep 2022 15:24:31 +0200 Subject: [PATCH] Added support for 1.1.0 core library --- Cargo.lock | 2 +- anime-game-core | 2 +- src/ui/components/voiceover_row.rs | 6 ++++-- src/ui/first_run/mod.rs | 5 +++-- src/ui/main.rs | 9 +++++---- src/ui/traits/download_component.rs | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a4fd01..57f6162 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,7 +31,7 @@ dependencies = [ [[package]] name = "anime-game-core" -version = "1.0.3" +version = "1.1.0" dependencies = [ "anyhow", "bzip2", diff --git a/anime-game-core b/anime-game-core index a32856d..6adbca8 160000 --- a/anime-game-core +++ b/anime-game-core @@ -1 +1 @@ -Subproject commit a32856db7dcb66f5d61ceab20e3bf3716b9ed6fa +Subproject commit 6adbca88936bcb16d10063fe58688cc7b10813b2 diff --git a/src/ui/components/voiceover_row.rs b/src/ui/components/voiceover_row.rs index 76d9900..886a85a 100644 --- a/src/ui/components/voiceover_row.rs +++ b/src/ui/components/voiceover_row.rs @@ -1,6 +1,8 @@ use gtk4::{self as gtk, prelude::*}; use libadwaita::{self as adw, prelude::*}; +use std::path::PathBuf; + use anime_game_core::genshin::voice_data::package::VoicePackage; #[derive(Debug, Clone)] @@ -31,7 +33,7 @@ impl VoiceoverRow { } } - pub fn update_state(&self, game_path: T) { + pub fn update_state>(&self, game_path: T) { if self.is_downloaded(game_path) { self.button.set_icon_name("user-trash-symbolic"); } @@ -41,7 +43,7 @@ impl VoiceoverRow { } } - pub fn is_downloaded(&self, game_path: T) -> bool { + pub fn is_downloaded>(&self, game_path: T) -> bool { self.package.is_installed_in(game_path) } } diff --git a/src/ui/first_run/mod.rs b/src/ui/first_run/mod.rs index 318d409..03e965b 100644 --- a/src/ui/first_run/mod.rs +++ b/src/ui/first_run/mod.rs @@ -7,6 +7,7 @@ use gtk::glib::clone; use std::rc::Rc; use std::cell::Cell; use std::process::Command; +use std::path::PathBuf; use anime_game_core::prelude::*; @@ -261,7 +262,7 @@ impl App { match Installer::new(&wine_version_copy.uri) { Ok(mut installer) => { if let Some(temp_folder) = config.launcher.temp { - installer.temp_folder = temp_folder; + installer.temp_folder = PathBuf::from(temp_folder); } installer.downloader @@ -326,7 +327,7 @@ impl App { match Installer::new(&dxvk_version.uri) { Ok(mut installer) => { if let Some(temp_folder) = config.launcher.temp { - installer.temp_folder = temp_folder; + installer.temp_folder = PathBuf::from(temp_folder); } installer.downloader diff --git a/src/ui/main.rs b/src/ui/main.rs index f67e2b1..03dbffb 100644 --- a/src/ui/main.rs +++ b/src/ui/main.rs @@ -8,6 +8,7 @@ use std::rc::Rc; use std::cell::Cell; use std::io::Error; use std::process::{Command, Stdio}; +use std::path::PathBuf; use wait_not_await::Await; @@ -435,7 +436,7 @@ impl App { match Installer::new(wine.uri) { Ok(mut installer) => { if let Some(temp_folder) = config.launcher.temp { - installer.temp_folder = temp_folder; + installer.temp_folder = PathBuf::from(temp_folder); } installer.downloader @@ -694,7 +695,7 @@ impl App { println!("Found broken files:"); for file in &broken { - println!(" - {}", file.path); + println!(" - {:?}", file.path); } let total = broken.len() as f64; @@ -706,9 +707,9 @@ impl App { println!("Patch status: {}", is_patch_applied); - fn should_ignore(path: &str) -> bool { + fn should_ignore(path: &PathBuf) -> bool { for part in ["UnityPlayer.dll", "xlua.dll", "crashreport.exe", "upload_crash.exe", "vulkan-1.dll"] { - if path.contains(part) { + if path.to_string_lossy().contains(part) { return true; } } diff --git a/src/ui/traits/download_component.rs b/src/ui/traits/download_component.rs index 79eab12..61df6f2 100644 --- a/src/ui/traits/download_component.rs +++ b/src/ui/traits/download_component.rs @@ -2,7 +2,7 @@ use gtk4::{self as gtk, prelude::*}; use gtk::glib; -use std::path::Path; +use std::path::{Path, PathBuf}; use anime_game_core::prelude::*; use wait_not_await::Await; @@ -83,7 +83,7 @@ pub trait DownloadComponent { let mut installer = Installer::new(self.get_download_uri())?; if let Some(temp_folder) = config.launcher.temp { - installer.temp_folder = temp_folder; + installer.temp_folder = PathBuf::from(temp_folder); } installer.downloader