diff --git a/src-tauri/src/game/client.rs b/src-tauri/src/game/client.rs index 6cd1bfa2..a684cf8e 100644 --- a/src-tauri/src/game/client.rs +++ b/src-tauri/src/game/client.rs @@ -1,4 +1,4 @@ -use std::{env, error::Error, fs, path::PathBuf}; +use std::{collections::HashMap, env, error::Error, fs, path::PathBuf}; use async_trait::async_trait; use serde::{Deserialize, Serialize}; @@ -60,6 +60,8 @@ pub fn get_game_client(handle: AppHandle, details: GameClientDetails) -> Box Self where Self: Sized; + fn get_version_urls() -> HashMap where Self: Sized; + fn get_details_from_version(version: String) -> Result> where Self: Sized; fn get_handle(&self) -> &AppHandle; fn get_details(&self) -> &GameClientDetails; diff --git a/src-tauri/src/game/clients/vanilla.rs b/src-tauri/src/game/clients/vanilla.rs index 8878a277..f3b8087f 100644 --- a/src-tauri/src/game/clients/vanilla.rs +++ b/src-tauri/src/game/clients/vanilla.rs @@ -1,4 +1,4 @@ -use std::error::Error; +use std::{collections::HashMap, error::Error}; use async_trait::async_trait; use tauri::AppHandle; @@ -9,6 +9,22 @@ use crate::{create_client, create_manifest, game::client::{GameClient, GameClien create_manifest!(VanillaManifest {}); create_client!(VanillaClient {}); +pub mod vanilla_impl { + use std::error::Error; + + pub async fn install_libraries() -> Result<(), Box> { + Ok(()) + } + + pub async fn install_natives() -> Result<(), Box> { + Ok(()) + } + + pub async fn install_assets() -> Result<(), Box> { + Ok(()) + } +} + #[async_trait] impl GameClient for VanillaClient { fn new(handle: AppHandle, details: GameClientDetails) -> Self { @@ -18,6 +34,14 @@ impl GameClient for VanillaClient { } } + fn get_version_urls() -> HashMap { + HashMap::new() + } + + fn get_details_from_version(version: String) -> Result> { + Err("a".into()) + } + fn get_handle(&self) -> &AppHandle { &self.handle } @@ -31,9 +55,9 @@ impl GameClient for VanillaClient { } async fn install(&self) -> Result<(), Box> { - println!("Installing Vanilla client"); - tokio::time::sleep(std::time::Duration::from_secs(5)).await; - println!("Vanilla client installed"); + vanilla_impl::install_libraries().await?; + vanilla_impl::install_natives().await?; + vanilla_impl::install_assets().await?; Ok(()) } diff --git a/src/ui/pages/Browser.tsx b/src/ui/pages/Browser.tsx index 502ab3fc..836793e9 100644 --- a/src/ui/pages/Browser.tsx +++ b/src/ui/pages/Browser.tsx @@ -7,9 +7,11 @@ function BrowserPage() {

Browser