From c0bf5cf95497042db5d4a52e5188f7543ab2549c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 09:33:13 +0100 Subject: [PATCH] Dedicated: the list saves log vanilla's warnings DedicatedPlayerList logs "Failed to save user banlist: " (and ip banlist, operators list, white-list) when a startup save fails; the shared closure printed "Failed to load user banlist write". The closure now takes the verb, so loads and saves read as vanilla's lines. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/dedicated.rs | 30 ++++++++------------- crates/horizon-client/src/save.rs | 4 +-- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/crates/horizon-client/src/game/dedicated.rs b/crates/horizon-client/src/game/dedicated.rs index 4e91b9704..2c1a23696 100644 --- a/crates/horizon-client/src/game/dedicated.rs +++ b/crates/horizon-client/src/game/dedicated.rs @@ -218,30 +218,22 @@ impl Lists { use_whitelist: false, enforce_whitelist: false, }; + // DedicatedPlayerList's constructor order and its LOGGER.warn lines. let warn = |what: &str, r: std::result::Result<(), String>| { if let Err(e) = r { - log("WARN", &format!("Failed to load {what}: {e}")); + log("WARN", &format!("Failed to {what}: {e}")); } }; - // DedicatedPlayerList's constructor order. - warn("user banlist", l.bans.load()); - warn( - "user banlist write", - l.bans.save().map_err(|e| e.to_string()), - ); - warn("ip banlist", l.ip_bans.load()); - warn( - "ip banlist write", - l.ip_bans.save().map_err(|e| e.to_string()), - ); - warn("operators list", l.ops.load()); - warn("white-list", l.white.load()); - warn("operators write", l.ops.save().map_err(|e| e.to_string())); + let saved = |r: std::io::Result<()>| r.map_err(|e| e.to_string()); + warn("load user banlist", l.bans.load()); + warn("save user banlist", saved(l.bans.save())); + warn("load ip banlist", l.ip_bans.load()); + warn("save ip banlist", saved(l.ip_bans.save())); + warn("load operators list", l.ops.load()); + warn("load white-list", l.white.load()); + warn("save operators list", saved(l.ops.save())); if !l.white.file.exists() { - warn( - "white-list write", - l.white.save().map_err(|e| e.to_string()), - ); + warn("save white-list", saved(l.white.save())); } l } diff --git a/crates/horizon-client/src/save.rs b/crates/horizon-client/src/save.rs index 9dc7f62fd..da5735c17 100644 --- a/crates/horizon-client/src/save.rs +++ b/crates/horizon-client/src/save.rs @@ -1913,9 +1913,7 @@ pub fn write_dat(path: &Path, tag: Tag) -> Result<()> { Some(stem) => path.with_file_name(format!("{stem}.dat_old")), None => path.with_file_name(format!("{file}_old")), }; - // Vanilla's safeReplaceFile moves the current file aside first. This used to be - // swallowed, and the rename below then failed on the existing path with nothing - // reporting it: a save that could not happen looked like one that did. + // Util.safeReplaceFile: no backup, no replacement. fs::rename(path, old).map_err(|e| format!("{}: {e}", path.display()))?; } fs::rename(temporary, path)?;