mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-10 04:22:13 +10:00
* fix: launching on linux * feat: #70 * feat: add dummy store page * feat: add store redir and refresh button to library * feat: cache first object fetching * feat: Remove let_chains feature and update to Rust 2024 Signed-off-by: quexeky <git@quexeky.dev> * feat: Check for if process was manually stopped Signed-off-by: quexeky <git@quexeky.dev> * fix: use bitcode instead of serde * chore: remove logs * fix: clippy * fix: clippy 2 * fix: swap to stop icon --------- Signed-off-by: quexeky <git@quexeky.dev> Co-authored-by: quexeky <git@quexeky.dev>
51 lines
1.3 KiB
Rust
51 lines
1.3 KiB
Rust
use std::sync::Mutex;
|
|
|
|
use crate::{error::process_error::ProcessError, AppState};
|
|
|
|
#[tauri::command]
|
|
pub fn launch_game(
|
|
id: String,
|
|
state: tauri::State<'_, Mutex<AppState>>,
|
|
) -> Result<(), ProcessError> {
|
|
let state_lock = state.lock().unwrap();
|
|
let mut process_manager_lock = state_lock.process_manager.lock().unwrap();
|
|
|
|
//let meta = DownloadableMetadata {
|
|
// id,
|
|
// version: Some(version),
|
|
// download_type: DownloadType::Game,
|
|
//};
|
|
|
|
match process_manager_lock.launch_process(id) {
|
|
Ok(_) => {}
|
|
Err(e) => return Err(e),
|
|
};
|
|
|
|
drop(process_manager_lock);
|
|
drop(state_lock);
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn kill_game(
|
|
game_id: String,
|
|
state: tauri::State<'_, Mutex<AppState>>,
|
|
) -> Result<(), ProcessError> {
|
|
let state_lock = state.lock().unwrap();
|
|
let mut process_manager_lock = state_lock.process_manager.lock().unwrap();
|
|
process_manager_lock
|
|
.kill_game(game_id)
|
|
.map_err(ProcessError::IOError)
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn open_process_logs(
|
|
game_id: String,
|
|
state: tauri::State<'_, Mutex<AppState>>,
|
|
) -> Result<(), ProcessError> {
|
|
let state_lock = state.lock().unwrap();
|
|
let mut process_manager_lock = state_lock.process_manager.lock().unwrap();
|
|
process_manager_lock.open_process_logs(game_id)
|
|
}
|