From ae04099daadfa25c3eeb14b7c70fc7f40bac6497 Mon Sep 17 00:00:00 2001 From: quexeky Date: Sat, 7 Jun 2025 09:54:41 +1000 Subject: [PATCH] refactor: Rename StoredManifest to DropData Signed-off-by: quexeky --- src-tauri/src/games/downloads/download_agent.rs | 6 +++--- .../downloads/{stored_manifest.rs => drop_data.rs} | 12 ++++++------ src-tauri/src/games/downloads/mod.rs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) rename src-tauri/src/games/downloads/{stored_manifest.rs => drop_data.rs} (84%) diff --git a/src-tauri/src/games/downloads/download_agent.rs b/src-tauri/src/games/downloads/download_agent.rs index 267cd9b..0bf968d 100644 --- a/src-tauri/src/games/downloads/download_agent.rs +++ b/src-tauri/src/games/downloads/download_agent.rs @@ -27,7 +27,7 @@ use tauri::{AppHandle, Emitter}; use rustix::fs::{fallocate, FallocateFlags}; use super::download_logic::download_game_chunk; -use super::stored_manifest::StoredManifest; +use super::drop_data::DropData; pub struct GameDownloadAgent { pub id: String, @@ -38,7 +38,7 @@ pub struct GameDownloadAgent { pub manifest: Mutex>, pub progress: Arc, sender: Sender, - pub stored_manifest: StoredManifest, + pub stored_manifest: DropData, status: Mutex, } @@ -60,7 +60,7 @@ impl GameDownloadAgent { let data_base_dir_path = base_dir_path.join(id.clone()); let stored_manifest = - StoredManifest::generate(id.clone(), version.clone(), data_base_dir_path.clone()); + DropData::generate(id.clone(), version.clone(), data_base_dir_path.clone()); Self { id, diff --git a/src-tauri/src/games/downloads/stored_manifest.rs b/src-tauri/src/games/downloads/drop_data.rs similarity index 84% rename from src-tauri/src/games/downloads/stored_manifest.rs rename to src-tauri/src/games/downloads/drop_data.rs index fdc232b..9534cf6 100644 --- a/src-tauri/src/games/downloads/stored_manifest.rs +++ b/src-tauri/src/games/downloads/drop_data.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; use serde_binary::binary_stream::Endian; #[derive(Serialize, Deserialize, Debug)] -pub struct StoredManifest { +pub struct DropData { game_id: String, game_version: String, pub completed_contexts: Mutex>, @@ -19,7 +19,7 @@ pub struct StoredManifest { static DROP_DATA_PATH: &str = ".dropdata"; -impl StoredManifest { +impl DropData { pub fn new(game_id: String, game_version: String, base_path: PathBuf) -> Self { Self { base_path, @@ -31,7 +31,7 @@ impl StoredManifest { pub fn generate(game_id: String, game_version: String, base_path: PathBuf) -> Self { let mut file = match File::open(base_path.join(DROP_DATA_PATH)) { Ok(file) => file, - Err(_) => return StoredManifest::new(game_id, game_version, base_path), + Err(_) => return DropData::new(game_id, game_version, base_path), }; let mut s = Vec::new(); @@ -39,15 +39,15 @@ impl StoredManifest { Ok(_) => {} Err(e) => { error!("{}", e); - return StoredManifest::new(game_id, game_version, base_path); + return DropData::new(game_id, game_version, base_path); } }; - match serde_binary::from_vec::(s, Endian::Little) { + match serde_binary::from_vec::(s, Endian::Little) { Ok(manifest) => manifest, Err(e) => { warn!("{}", e); - StoredManifest::new(game_id, game_version, base_path) + DropData::new(game_id, game_version, base_path) } } } diff --git a/src-tauri/src/games/downloads/mod.rs b/src-tauri/src/games/downloads/mod.rs index c9b3cd4..2cddd0e 100644 --- a/src-tauri/src/games/downloads/mod.rs +++ b/src-tauri/src/games/downloads/mod.rs @@ -2,4 +2,4 @@ pub mod commands; pub mod download_agent; mod download_logic; mod manifest; -mod stored_manifest; +mod drop_data;