aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src/main.rs
blob: fdd07940b3c648a8be2989c70aa7ffcbd5469528 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

mod core;
mod launcher;

#[tauri::command]
async fn start_game() -> Result<String, String> {
    println!("Backend received StartGame");
    match core::manifest::fetch_version_manifest().await {
        Ok(manifest) => {
            let msg = format!(
                "Fetched manifest.\nLatest release: {}\nLatest snapshot: {}",
                manifest.latest.release, manifest.latest.snapshot
            );
            println!("{}", msg);
            Ok(msg)
        }
        Err(e) => {
            eprintln!("Error fetching manifest: {}", e);
            Err(e.to_string())
        }
    }
}

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_shell::init())
        .invoke_handler(tauri::generate_handler![start_game])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}