[server] only provide games that exist in games folder
This commit is contained in:
parent
3610eb77a6
commit
1dd25f682b
@ -319,6 +319,17 @@ async fn main() -> eyre::Result<()> {
|
|||||||
|
|
||||||
let eti_games = eti::get_games(&cli.db).await?;
|
let eti_games = eti::get_games(&cli.db).await?;
|
||||||
let mut games: Vec<Game> = eti_games.into_iter().map(eti_game_to_game).collect();
|
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);
|
let thumbnails = Thumbnails::new(cli.thumbnails);
|
||||||
|
|
||||||
// add thumbnails to games
|
// add thumbnails to games
|
||||||
|
Loading…
x
Reference in New Issue
Block a user