Play game: first start done marker, local dir check

This commit is contained in:
2025-11-13 21:53:00 +01:00
parent 8fe68f9574
commit d785fcc93a
@@ -1,3 +1,5 @@
#[cfg(target_os = "windows")]
use std::fs::File;
use std::{
collections::HashSet,
path::{Path, PathBuf},
@@ -21,6 +23,9 @@ struct LanSpreadState {
games_folder: Arc<RwLock<String>>,
}
#[cfg(target_os = "windows")]
const FIRST_START_DONE_FILE: &str = ".softlan_first_start_done";
#[tauri::command]
async fn request_games(state: tauri::State<'_, LanSpreadState>) -> tauri::Result<()> {
log::debug!("request_games");
@@ -250,8 +255,16 @@ async fn run_game_windows(
let game_setup_bin = game_path.join("game_setup.cmd");
let game_start_bin = game_path.join("game_start.cmd");
let local_ready = local_install_is_ready(&game_path);
if !local_ready && game_setup_bin.exists() {
let first_start_done_file = game_path.join("local").join(FIRST_START_DONE_FILE);
if !first_start_done_file.exists() && game_setup_bin.exists() {
if !local_install_is_ready(&game_path) {
log::warn!(
"local install is missing or incomplete for {}; skipping game_setup",
game_path.display()
);
return Ok(());
}
let result = run_as_admin(
"cmd.exe",
&format!(
@@ -266,6 +279,13 @@ async fn run_game_windows(
log::error!("failed to run game_setup.cmd");
return Ok(());
}
if let Err(e) = File::create(&first_start_done_file) {
log::error!(
"failed to create first-start marker {}: {e}",
first_start_done_file.display()
);
}
}
if game_start_bin.exists() {