mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-02-16 15:22:01 +03:00
Now launcher will run the game with --run-game
flag
even when predownloading is available, but if update was already predownloaded
This commit is contained in:
parent
a462583b7b
commit
e375af1c95
2 changed files with 39 additions and 7 deletions
38
src/main.rs
38
src/main.rs
|
@ -107,14 +107,46 @@ fn main() {
|
|||
}
|
||||
|
||||
else {
|
||||
use lib::launcher::states::LauncherState;
|
||||
|
||||
awaiter.then(move |state| {
|
||||
match state.as_ref().expect("Failed to load launcher state") {
|
||||
lib::launcher::states::LauncherState::Launch => {
|
||||
let mut state = state.as_ref().expect("Failed to load launcher state");
|
||||
|
||||
#[allow(clippy::or_fun_call)]
|
||||
if let LauncherState::PredownloadAvailable { game, voices } = state {
|
||||
if let Ok(config) = lib::config::get() {
|
||||
let mut predownloaded = true;
|
||||
|
||||
let temp = config.launcher.temp.unwrap_or("/tmp".into());
|
||||
|
||||
if !temp.join(game.file_name().unwrap_or(String::from("\0"))).exists() {
|
||||
predownloaded = false;
|
||||
}
|
||||
|
||||
else {
|
||||
for voice in voices {
|
||||
if !temp.join(voice.file_name().unwrap_or(String::from("\0"))).exists() {
|
||||
predownloaded = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if predownloaded {
|
||||
state = &LauncherState::Launch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
match state {
|
||||
LauncherState::Launch => {
|
||||
main.update(ui::main::Actions::PerformButtonEvent).unwrap();
|
||||
|
||||
std::thread::sleep(std::time::Duration::from_secs(5));
|
||||
std::process::exit(0);
|
||||
},
|
||||
}
|
||||
|
||||
_ => main.show()
|
||||
}
|
||||
});
|
||||
|
|
|
@ -357,7 +357,7 @@ impl App {
|
|||
this.widgets.window.show();
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
LauncherState::PatchAvailable(patch) => {
|
||||
match patch {
|
||||
|
@ -624,15 +624,15 @@ impl App {
|
|||
std::thread::spawn(clone!(@strong this => move || {
|
||||
for mut diff in diffs {
|
||||
let sender = sender.clone();
|
||||
|
||||
|
||||
#[allow(unused_must_use)]
|
||||
let result = diff.download_in(config.launcher.temp.as_ref().unwrap(), move |curr, total| {
|
||||
sender.send(InstallerUpdate::DownloadingProgress(curr, total));
|
||||
});
|
||||
|
||||
|
||||
if let Err(err) = result {
|
||||
let err: Error = err.into();
|
||||
|
||||
|
||||
this.update(Actions::Toast(Rc::new((
|
||||
String::from("Downloading failed"), err.to_string()
|
||||
)))).unwrap();
|
||||
|
|
Loading…
Add table
Reference in a new issue