[server] only provide games that exist in games folder

This commit is contained in:
ddidderr 2024-11-15 12:15:50 +01:00
parent 3610eb77a6
commit 1dd25f682b
Signed by: ddidderr
GPG Key ID: 3841F1C27E6F0E14

View File

@ -319,6 +319,17 @@ async fn main() -> eyre::Result<()> {
let eti_games = eti::get_games(&cli.db).await?;
let mut games: Vec<Game> = eti_games.into_iter().map(eti_game_to_game).collect();
// Filter games based on existing folders
games.retain(|game| {
let game_folder = cli.folder.join(&game.id);
let exists = game_folder.exists() && game_folder.is_dir();
if !exists {
tracing::debug!("Skipping game {}: folder not found", game.id);
}
exists
});
let thumbnails = Thumbnails::new(cli.thumbnails);
// add thumbnails to games