feat: less bad launches

This commit is contained in:
2025-02-23 23:48:00 +01:00
parent fcd3855c49
commit 70b8b3ae55
27 changed files with 145 additions and 34 deletions

View File

@ -9,18 +9,21 @@ use crate::profile::Profile;
use crate::appdata::AppData;
use crate::{liner, start};
use tauri::State;
use tauri::{AppHandle, Manager, State};
#[tauri::command]
pub async fn startline(state: State<'_, Mutex<AppData>>) -> Result<(), String> {
pub async fn startline(app: AppHandle) -> Result<(), String> {
log::debug!("invoke: startline");
let app_copy = app.clone();
let state = app.state::<Mutex<AppData>>();
let appd = state.lock().await;
if let Some(p) = &appd.profile {
// TODO if p.needsUpdate
liner::line_up(p).await.expect("Line-up failed");
start::start(p).map_err(|e| { log::error!("Error launching: {}", e.to_string()); e.to_string() }).map(|_| ())
start::start(p, app_copy)
.map_err(|e| { log::error!("Error launching: {}", e.to_string()); e.to_string() })
//Ok(())
} else {
Err("No profile".to_owned())