forked from akanyan/STARTLINER
feat: less bad launches
This commit is contained in:
@ -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())
|
||||
|
Reference in New Issue
Block a user