wip
This commit is contained in:
@@ -1117,31 +1117,38 @@ async fn load_local_game_db(game_dir: &str) -> eyre::Result<GameDB> {
|
||||
continue;
|
||||
}
|
||||
|
||||
if !local_dir_has_content(&path).await {
|
||||
continue;
|
||||
}
|
||||
let installed = local_dir_has_content(&path).await;
|
||||
let local_version = if installed {
|
||||
match lanspread_db::db::read_version_from_ini(&path) {
|
||||
Ok(version) => version,
|
||||
Err(e) => {
|
||||
log::warn!("Failed to read version.ini for installed game {game_id}: {e}");
|
||||
None
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
if let Ok(version) = lanspread_db::db::read_version_from_ini(&path) {
|
||||
let size = calculate_directory_size(&path).await?;
|
||||
let game = Game {
|
||||
id: game_id.to_string(),
|
||||
name: game_id.to_string(),
|
||||
description: String::new(),
|
||||
release_year: String::new(),
|
||||
publisher: String::new(),
|
||||
max_players: 1,
|
||||
version: "1.0".to_string(),
|
||||
genre: String::new(),
|
||||
size,
|
||||
thumbnail: None,
|
||||
downloaded,
|
||||
installed: true,
|
||||
eti_game_version: version.clone(),
|
||||
local_version: version,
|
||||
peer_count: 0, // Local games start with 0 peers
|
||||
};
|
||||
games.push(game);
|
||||
}
|
||||
let size = calculate_directory_size(&path).await?;
|
||||
let game = Game {
|
||||
id: game_id.to_string(),
|
||||
name: game_id.to_string(),
|
||||
description: String::new(),
|
||||
release_year: String::new(),
|
||||
publisher: String::new(),
|
||||
max_players: 1,
|
||||
version: "1.0".to_string(),
|
||||
genre: String::new(),
|
||||
size,
|
||||
thumbnail: None,
|
||||
downloaded,
|
||||
installed,
|
||||
eti_game_version: local_version.clone(),
|
||||
local_version,
|
||||
peer_count: 0, // Local games start with 0 peers
|
||||
};
|
||||
games.push(game);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user