Files
khadhroony-solana-project/crates/ksp-app-config-desk/src/tauri.rs
2026-08-16 10:40:23 +02:00

34 lines
1.4 KiB
Rust

// file: crates/ksp-app-config-desk/src/tauri.rs
// version: 1
//! Tauri runtime assembly for the KSP configuration desktop application.
use tauri::Manager; // rust-rules: trait-import
/// Runs the configuration desktop application.
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run(_arguments: &[std::ffi::OsString]) -> ksp_core_lib::Result<()> {
let mut builder = tauri::Builder::default();
builder = configure_setup(builder);
let run_result = builder.run(tauri::generate_context!());
return match run_result {
std::result::Result::Ok(()) => std::result::Result::Ok(()),
std::result::Result::Err(error) => std::result::Result::Err(
ksp_core_lib::Error::new(crate::ERROR_CODE_TAURI_RUNTIME_FAILED, "Cannot run KSP Config Desk Tauri runtime")
.with_context("tauri_error", error.to_string()),
),
};
}
fn configure_setup(builder: tauri::Builder<tauri::Wry>) -> tauri::Builder<tauri::Wry> {
return builder.setup(|app| {
if app.get_webview_window("splash").is_none() {
return std::result::Result::Err(std::boxed::Box::new(std::io::Error::new(std::io::ErrorKind::NotFound, "splash window is missing")));
}
if app.get_webview_window("main").is_none() {
return std::result::Result::Err(std::boxed::Box::new(std::io::Error::new(std::io::ErrorKind::NotFound, "main window is missing")));
}
return std::result::Result::Ok(());
});
}