feat: bootstrap ShaCraft cross-platform launcher

This commit is contained in:
emil28092005
2026-09-06 00:14:29 +03:00
commit 4a1ab087c8
16 changed files with 6468 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
use serde::Serialize;
use tauri::{AppHandle, Manager};
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct NativeHost {
platform: &'static str,
data_dir: String,
launcher_version: &'static str,
}
/// Returns non-sensitive environment information needed by the interface.
/// File access and child-process launching are deliberately not exposed yet.
#[tauri::command]
fn native_host(app: AppHandle) -> Result<NativeHost, String> {
let data_dir = app
.path()
.app_data_dir()
.map_err(|error| format!("Cannot resolve launcher data directory: {error}"))?;
Ok(NativeHost {
platform: std::env::consts::OS,
data_dir: data_dir.display().to_string(),
launcher_version: env!("CARGO_PKG_VERSION"),
})
}
pub fn run() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![native_host])
.run(tauri::generate_context!())
.expect("error while running ShaCraft Launcher");
}
+5
View File
@@ -0,0 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
shacraft_launcher_lib::run()
}