mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-14 08:41:21 +10:00
commit3b09dcfb73Author: quexeky <git@quexeky.dev> Date: Mon Oct 13 08:10:52 2025 +1100 fix: #159 Signed-off-by: quexeky <git@quexeky.dev> commit2859a59622Author: quexeky <git@quexeky.dev> Date: Mon Oct 13 08:03:49 2025 +1100 Squashed commit of the following: commit0f48f3fb44Author: quexeky <git@quexeky.dev> Date: Sun Oct 12 19:35:04 2025 +1100 chore: Run cargo clippy && cargo fmt Signed-off-by: quexeky <git@quexeky.dev> commit974666efe2Author: quexeky <git@quexeky.dev> Date: Sun Oct 12 19:17:40 2025 +1100 refactor: Finish refactor Signed-off-by: quexeky <git@quexeky.dev> commit9e1bf9852fAuthor: quexeky <git@quexeky.dev> Date: Sun Oct 12 18:33:43 2025 +1100 refactor: Builds, but some logic still left to move back Signed-off-by: quexeky <git@quexeky.dev> commit5d22b883d5Author: quexeky <git@quexeky.dev> Date: Sun Oct 12 17:04:27 2025 +1100 refactor: Improvements to src-tauri Signed-off-by: quexeky <git@quexeky.dev> commit62a2561539Author: quexeky <git@quexeky.dev> Date: Sat Oct 11 09:51:04 2025 +1100 fix: Remote tauri dependency from process Signed-off-by: quexeky <git@quexeky.dev> commit59f040bc8bAuthor: quexeky <git@quexeky.dev> Date: Thu Oct 9 07:46:17 2025 +1100 chore: Major refactoring Still needs a massive go-over because there shouldn't be anything referencing tauri in any of the workspaces except the original one. Process manager has been refactored as an example Signed-off-by: quexeky <git@quexeky.dev> Signed-off-by: quexeky <git@quexeky.dev> Signed-off-by: quexeky <git@quexeky.dev>
51 lines
1.2 KiB
Rust
51 lines
1.2 KiB
Rust
use std::sync::nonpoison::Mutex;
|
|
|
|
use process::{PROCESS_MANAGER, error::ProcessError};
|
|
use tauri::AppHandle;
|
|
use tauri_plugin_opener::OpenerExt;
|
|
|
|
use crate::AppState;
|
|
|
|
#[tauri::command]
|
|
pub fn launch_game(
|
|
id: String,
|
|
state: tauri::State<'_, Mutex<AppState>>,
|
|
) -> Result<(), ProcessError> {
|
|
let state_lock = state.lock();
|
|
let mut process_manager_lock = PROCESS_MANAGER.lock();
|
|
//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) -> Result<(), ProcessError> {
|
|
PROCESS_MANAGER
|
|
.lock()
|
|
.kill_game(game_id)
|
|
.map_err(ProcessError::IOError)
|
|
}
|
|
|
|
#[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(ProcessError::OpenerError)
|
|
}
|