feat: a wrong game data folder is diagnosed, and it can be changed from Settings

The world refusing to start with the standard Data set (no CoA DBC) is now
reported as GameDataMismatch. A Settings card shows the folder in use and
changes it while the server is stopped, using the install checks.
This commit is contained in:
Fabien F. committed 2026-10-11 08:57:43 +02:00
1 parent dfd8a50975
commit 0250b61c62
11 files changed
+151 -1

No files matched your search

+27
View File
@@ -110,6 +110,31 @@ fn summary(id: String, path: PathBuf) -> ServerSummary {
ServerSummary { id, name, path: path.to_string_lossy().into_owned() }
}
/// The game data folder of a Docker server; none for a repack, whose data is inside its own folder.
#[tauri::command]
fn game_data_folder(state: State<'_, AppState>, id: String) -> std::result::Result<Option<String>, UiError> {
let root = path_of(&state, &id)?;
if !coa_core::docker::is_docker(&root) {
return Ok(None);
}
Ok(Some(coa_core::docker::game_data_dir(&root)?.to_string_lossy().into_owned()))
}
/// Point a Docker server at another game data folder. The servers must be stopped.
#[tauri::command]
async fn set_game_data_folder(state: State<'_, AppState>, id: String, path: String) -> std::result::Result<String, UiError> {
let root = path_of(&state, &id)?;
let _guard = BusyGuard::acquire(&state, &id)?;
blocking(move || {
if !coa_core::docker::is_docker(&root) {
return Err(Error::Invalid("The game data of this server is inside its folder.".into()));
}
coa_core::docker::set_game_data(&root, std::path::Path::new(&path))?;
Ok(path)
})
.await
}
#[tauri::command]
fn default_install_dir() -> String {
if platform::flavor() == Flavor::Docker {
@@ -1688,6 +1713,8 @@ pub fn run() {
.manage(AppState { registry: Registry::at(dir.join("installs.json")), busy: Mutex::new(HashSet::new()), install_cancel: Mutex::new(None), client_cancel: Mutex::new(None) })
.invoke_handler(tauri::generate_handler![
default_install_dir,
game_data_folder,
set_game_data_folder,
install_environment,
scan_server,
add_server,