mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 01:09:56 -05:00
[BETA] Initial Commit (Nix Support Only)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
use std::sync::Mutex;
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_shell::{ShellExt, process::CommandChild};
|
||||
|
||||
struct ServerState(Mutex<Option<CommandChild>>);
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.manage(ServerState(Mutex::new(None)))
|
||||
.setup(|app| {
|
||||
let shell = app.shell();
|
||||
let app_handle = app.handle().clone();
|
||||
|
||||
let status = shell.command("tachidesk-server").spawn();
|
||||
|
||||
match status {
|
||||
Ok((_rx, child)) => {
|
||||
println!("Tachidesk server process spawned successfully.");
|
||||
let state = app_handle.state::<ServerState>();
|
||||
let mut guard = state.0.lock().unwrap();
|
||||
*guard = Some(child);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Failed to spawn Tachidesk server: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running moku");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
moku_lib::run();
|
||||
}
|
||||
Reference in New Issue
Block a user