fix: display has to be sequential after all

This commit is contained in:
2025-03-14 15:18:38 +00:00
parent 62edcdae08
commit b525e74467
6 changed files with 45 additions and 28 deletions

View File

@ -3,7 +3,7 @@ use ongeki::OngekiProfile;
use serde::{Deserialize, Serialize};
use tauri::AppHandle;
use std::{collections::BTreeSet, path::{Path, PathBuf}};
use crate::{model::misc::Game, modules::package::prepare_packages, pkg::PkgKey, util};
use crate::{model::{config::Display, misc::Game}, modules::package::prepare_packages, pkg::PkgKey, util};
pub mod ongeki;
@ -70,7 +70,28 @@ impl AnyProfile {
Self::OngekiProfile(p) => &mut p.mods
}
}
pub async fn line_up(&self, _app: AppHandle, pkg_hash: String) -> Result<()> {
pub async fn line_up(&self, pkg_hash: String, _app: AppHandle) -> Result<()> {
match self {
Self::OngekiProfile(p) => {
#[cfg(target_os = "windows")]
let info = p.display.line_up()?;
let res = self.line_up_the_rest(pkg_hash).await;
#[cfg(target_os = "windows")]
if let Some(info) = info {
if res.is_ok() {
Display::wait_for_exit(_app, info);
} else {
Display::clean_up(&info)?;
}
}
res
}
}
}
async fn line_up_the_rest(&self, pkg_hash: String) -> Result<()> {
match self {
Self::OngekiProfile(p) => {
if !p.data_dir().exists() {
@ -80,9 +101,6 @@ impl AnyProfile {
let hash_path = p.data_dir().join(".sl-state");
let meta = self.meta();
#[cfg(target_os = "windows")]
p.display.activate(_app.clone());
util::clean_up_opts(p.data_dir().join("option"))?;
if Self::hash_check(&hash_path, &pkg_hash).await? == true {