Compare commits

...

3 Commits

Author SHA1 Message Date
02d84c4d84 code: better debug for install state 2025-08-17 16:07:06 +02:00
ca40a62ff8 clippy/fmt: just fix applied 2025-08-17 16:04:45 +02:00
3dcc0271b8 justfile: typical cargo commands 2025-08-17 16:04:09 +02:00
2 changed files with 495 additions and 485 deletions

View File

@@ -150,18 +150,17 @@ fn run_game(id: String, state: tauri::State<LanSpreadState>) {
} }
fn set_game_install_state_from_path(game_db: &mut GameDB, path: &Path, installed: bool) { fn set_game_install_state_from_path(game_db: &mut GameDB, path: &Path, installed: bool) {
if let Some(file_name) = path.file_name() { if let Some(file_name) = path.file_name()
if let Some(file_name) = file_name.to_str() { && let Some(file_name) = file_name.to_str()
if let Some(game) = game_db.get_mut_game_by_id(file_name) { && let Some(game) = game_db.get_mut_game_by_id(file_name)
{
if installed { if installed {
log::debug!("Game is installed: {game}"); log::debug!("Set {game} to installed");
} else { } else {
log::error!("Game is missing: {game}"); log::debug!("Set {game} to uninstalled");
} }
game.installed = installed; game.installed = installed;
} }
}
}
} }
#[tauri::command] #[tauri::command]
@@ -213,16 +212,15 @@ fn update_game_directory(app_handle: tauri::AppHandle, path: String) {
// update game_db with installed games from real game directory // update game_db with installed games from real game directory
entries.into_iter().for_each(|entry| { entries.into_iter().for_each(|entry| {
if let Ok(entry) = entry { if let Ok(entry) = entry
if let Ok(path_type) = entry.file_type() { && let Ok(path_type) = entry.file_type()
if path_type.is_dir() { && path_type.is_dir()
{
let path = entry.path(); let path = entry.path();
if path.join("version.ini").exists() { if path.join("version.ini").exists() {
set_game_install_state_from_path(&mut game_db, &path, true); set_game_install_state_from_path(&mut game_db, &path, true);
} }
} }
}
}
}); });
if let Err(e) = app_handle.emit("games-list-updated", Some(game_db.all_games())) { if let Err(e) = app_handle.emit("games-list-updated", Some(game_db.all_games())) {

View File

@@ -6,5 +6,17 @@ server:
client: client:
cargo tauri dev cargo tauri dev
fmt:
cargo +nightly fmt
_fix:
cargo fix
cargo clippy --fix
fix: _fix fmt
clippy:
cargo clippy
clean: clean:
cargo clean cargo clean