Files
drop/desktop/src-tauri/src/process.rs
T
DecDuck fc69ae30ab Depot API & executor launch (#173)
* feat: depot api downloads

* feat: frontend fixes and experimental webview store

* feat: sync downloader

* feat: cleanup and fixes

* feat: encrypted database and fixed resuming

* feat: launch option selector

* fix: autostart when no options

* fix: clippy

* fix: clippy x2

* feat: executor launch

* feat: executor launch

* feat: not installed error handling

* feat: better offline handling

* feat: dependency popup

* fix: cancelation and resuming issues

* feat: dedup by platform

* feat: new ui for additional components and fix dl manager clog

* feat: auto-queue dependencies

* feat: depot scanning and ranking

* feat: new library fetching stack

* In-app store page (Windows + macOS) (#176)

* feat: async store loading

* feat: fix overscroll behaviour

* fix: query params in server protocol

* fix: clippy
2026-01-20 11:40:48 +11:00

63 lines
1.6 KiB
Rust

use std::sync::Arc;
use process::{
PROCESS_MANAGER,
error::ProcessError,
process_manager::{LaunchOption, ProcessManager},
};
use serde::Serialize;
use tauri::AppHandle;
use tauri_plugin_opener::OpenerExt;
#[tauri::command]
pub fn get_launch_options(id: String) -> Result<Vec<LaunchOption>, ProcessError> {
let launch_options = ProcessManager::get_launch_options(id)?;
Ok(launch_options)
}
#[derive(Serialize)]
#[serde(tag = "result", content = "data")]
pub enum LaunchResult {
Success,
InstallRequired(String, String),
}
#[tauri::command]
pub fn launch_game(id: String, index: usize) -> Result<LaunchResult, ProcessError> {
let result = {
let mut process_manager_lock = PROCESS_MANAGER.lock();
process_manager_lock.launch_process(id, index)
};
if let Err(err) = &result
&& let ProcessError::RequiredDependency(game_id, version_id) = err
{
return Ok(LaunchResult::InstallRequired(
game_id.to_string(),
version_id.to_string(),
));
}
result?;
Ok(LaunchResult::Success)
}
#[tauri::command]
pub fn kill_game(game_id: String) -> Result<(), ProcessError> {
Ok(PROCESS_MANAGER.lock().kill_game(game_id)?)
}
#[tauri::command]
pub fn open_process_logs(game_id: String, app_handle: AppHandle) -> Result<(), ProcessError> {
let process_manager_lock = PROCESS_MANAGER.lock();
let dir = process_manager_lock.get_log_dir(game_id);
app_handle
.opener()
.open_path(dir.display().to_string(), None::<&str>)
.map_err(|v| ProcessError::OpenerError(Arc::new(v)))
}