fix: (potentially) fixed a bug with pre-download button

This commit is contained in:
Nikita Podvirnyi 2024-08-29 18:05:48 +02:00
parent c6eb063973
commit dd85f1b6d3
No known key found for this signature in database
GPG key ID: 859D416E5142AFF3
2 changed files with 16 additions and 14 deletions

6
Cargo.lock generated
View file

@ -57,7 +57,8 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
[[package]] [[package]]
name = "anime-game-core" name = "anime-game-core"
version = "1.22.2" version = "1.23.0"
source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.23.0#9db1b598418c8c973b4e3afbdc17dcacc8511f3f"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bzip2", "bzip2",
@ -106,7 +107,8 @@ dependencies = [
[[package]] [[package]]
name = "anime-launcher-sdk" name = "anime-launcher-sdk"
version = "1.18.0" version = "1.19.0"
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.19.0#18bbd738c9e941b76c1883a969cf9de87e724646"
dependencies = [ dependencies = [
"anime-game-core", "anime-game-core",
"anyhow", "anyhow",

View file

@ -330,16 +330,16 @@ impl SimpleComponent for App {
let temp = config.launcher.temp.unwrap_or_else(std::env::temp_dir); let temp = config.launcher.temp.unwrap_or_else(std::env::temp_dir);
let mut downloaded = temp.join(game.file_name().unwrap()).metadata() let mut downloaded = temp.join(game.file_name().unwrap()).metadata()
.map(|metadata| Some(metadata.len()) == game.downloaded_size()) .map(|metadata| Some(metadata.len()) >= game.downloaded_size())
.unwrap_or(false); .unwrap_or(false);
if downloaded { if downloaded {
for voice in voices { for voice in voices {
downloaded = !temp.join(voice.file_name().unwrap()).metadata() downloaded = temp.join(voice.file_name().unwrap()).metadata()
.map(|metadata| Some(metadata.len()) == voice.downloaded_size()) .map(|metadata| Some(metadata.len()) >= voice.downloaded_size())
.unwrap_or(false); .unwrap_or(false);
if downloaded { if !downloaded {
break; break;
} }
} }
@ -358,16 +358,16 @@ impl SimpleComponent for App {
let temp = config.launcher.temp.unwrap_or_else(std::env::temp_dir); let temp = config.launcher.temp.unwrap_or_else(std::env::temp_dir);
let mut downloaded = temp.join(game.file_name().unwrap()).metadata() let mut downloaded = temp.join(game.file_name().unwrap()).metadata()
.map(|metadata| Some(metadata.len()) == game.downloaded_size()) .map(|metadata| Some(metadata.len()) >= game.downloaded_size())
.unwrap_or(false); .unwrap_or(false);
if downloaded { if downloaded {
for voice in voices { for voice in voices {
downloaded = !temp.join(voice.file_name().unwrap()).metadata() downloaded = temp.join(voice.file_name().unwrap()).metadata()
.map(|metadata| Some(metadata.len()) == voice.downloaded_size()) .map(|metadata| Some(metadata.len()) >= voice.downloaded_size())
.unwrap_or(false); .unwrap_or(false);
if downloaded { if !downloaded {
break; break;
} }
} }