feat: refresh+start button

This commit is contained in:
2025-03-28 23:20:04 +00:00
parent 8ac45df3e1
commit 90f36e5fa6
4 changed files with 33 additions and 11 deletions

View File

@ -151,13 +151,13 @@ impl Profile {
self.data.sgt = source.sgt;
// }
}
pub async fn line_up(&self, pkg_hash: String, _app: AppHandle) -> Result<()> {
pub async fn line_up(&self, pkg_hash: String, refresh: bool, _app: AppHandle) -> Result<()> {
let info = match &self.data.display {
None => None,
Some(display) => display.line_up()?
};
let res = self.line_up_the_rest(pkg_hash).await;
let res = self.line_up_the_rest(pkg_hash, refresh).await;
#[cfg(target_os = "windows")]
if let Some(info) = info {
@ -171,7 +171,7 @@ impl Profile {
res
}
async fn line_up_the_rest(&self, pkg_hash: String) -> Result<()> {
async fn line_up_the_rest(&self, pkg_hash: String, refresh: bool) -> Result<()> {
if !self.data_dir().exists() {
tokio::fs::create_dir(self.data_dir()).await?;
}
@ -180,7 +180,7 @@ impl Profile {
util::clean_up_opts(self.data_dir().join("option"))?;
let hash_check = Self::hash_check(&hash_path, &pkg_hash).await?;
let hash_check = Self::hash_check(&hash_path, &pkg_hash).await? || refresh;
prepare_packages(&self.meta, &self.data.mods, hash_check).await
.map_err(|e| anyhow!("package configuration failed:\n{:?}", e))?;
let mut ini = self.data.sgt.line_up(&self.meta, self.meta.game).await