diff options
Diffstat (limited to 'src-tauri/src/core/manifest.rs')
| -rw-r--r-- | src-tauri/src/core/manifest.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src-tauri/src/core/manifest.rs b/src-tauri/src/core/manifest.rs index bae87c9..637b935 100644 --- a/src-tauri/src/core/manifest.rs +++ b/src-tauri/src/core/manifest.rs @@ -25,6 +25,13 @@ pub struct Version { pub time: String, #[serde(rename = "releaseTime")] pub release_time: String, + /// Java version requirement (major version number) + /// This is populated from the version JSON file if the version is installed locally + #[serde(skip_serializing_if = "Option::is_none")] + pub java_version: Option<u64>, + /// Whether this version is installed locally + #[serde(rename = "isInstalled", skip_serializing_if = "Option::is_none")] + pub is_installed: Option<bool>, } pub async fn fetch_version_manifest() -> Result<VersionManifest, Box<dyn Error + Send + Sync>> { @@ -45,7 +52,7 @@ pub async fn fetch_version_manifest() -> Result<VersionManifest, Box<dyn Error + /// # Returns /// The parsed `GameVersion` if found, or an error if not found. pub async fn load_local_version( - game_dir: &PathBuf, + game_dir: &std::path::Path, version_id: &str, ) -> Result<GameVersion, Box<dyn Error + Send + Sync>> { let json_path = game_dir @@ -102,7 +109,7 @@ pub async fn fetch_vanilla_version( /// # Returns /// A fully resolved `GameVersion` ready for launching. pub async fn load_version( - game_dir: &PathBuf, + game_dir: &std::path::Path, version_id: &str, ) -> Result<GameVersion, Box<dyn Error + Send + Sync>> { // Try loading from local first @@ -138,7 +145,7 @@ pub async fn load_version( /// # Returns /// The path where the JSON was saved. pub async fn save_local_version( - game_dir: &PathBuf, + game_dir: &std::path::Path, version: &GameVersion, ) -> Result<PathBuf, Box<dyn Error + Send + Sync>> { let version_dir = game_dir.join("versions").join(&version.id); @@ -158,8 +165,9 @@ pub async fn save_local_version( /// /// # Returns /// A list of version IDs found in the versions directory. +#[allow(dead_code)] pub async fn list_local_versions( - game_dir: &PathBuf, + game_dir: &std::path::Path, ) -> Result<Vec<String>, Box<dyn Error + Send + Sync>> { let versions_dir = game_dir.join("versions"); let mut versions = Vec::new(); |