always a size

This commit is contained in:
2025-11-12 22:11:29 +01:00
parent 8b9e09ab81
commit bca85fbdc1
3 changed files with 68 additions and 84 deletions
+4 -5
View File
@@ -179,8 +179,7 @@ pub struct GameFileDescription {
pub game_id: String,
pub relative_path: String,
pub is_dir: bool,
#[serde(default)]
pub size: Option<u64>,
pub size: u64,
}
impl GameFileDescription {
@@ -190,8 +189,8 @@ impl GameFileDescription {
}
#[must_use]
pub fn file_size(&self) -> Option<u64> {
if self.is_dir { None } else { self.size }
pub fn file_size(&self) -> u64 {
if self.is_dir { 0 } else { self.size }
}
}
@@ -204,7 +203,7 @@ impl fmt::Debug for GameFileDescription {
self.game_id,
if self.is_dir { 'D' } else { 'F' },
self.relative_path,
self.size.unwrap_or_default(),
self.size,
)
}
}