Skip to content

Game updates go in whole or leave the game as it was - #303

Merged
elripalda merged 7 commits into
elripalda:mainfrom
Xarishark:feat/atomic-game-update
Nov 19, 2026
Merged

elripalda merged 7 commits into
elripalda:mainfrom
Xarishark:feat/atomic-game-update

Conversation

@Xarishark

@Xarishark Xarishark commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Before this change, an update unpacked into staging and then moved its files into the game's folder one at a time, then deleted the files the old release had and the new one doesn't. If something failed partway (a locked file, a full drive, the launcher closing), the game was left with a mix of old and new files and nothing undid it. Games keep more and more builds and caches in their own folder, so a half-applied update is expensive.

What changes

  • Unpacking is separate from putting files in place. install::stage unpacks the release beside the game's folder (<library>/.staging/<id>, so it's on the same drive). The Flatpak AppImage unpack and Mac zip unwrapping still happen there. A full drive or a bad archive stops the update before the game is touched.
  • New swap.rs. It sets aside, in <game>/.recomplauncher-game-update/old, what the new release replaces (Mac .app bundles go whole) and the old release's files it drops. Then it moves the new files in. On one drive both steps are renames. If any step fails, the new files come out and the old ones go back, and the error says which file stopped it and that nothing changed.
  • A marker (update.json) is written and synced to disk before anything moves. At startup, and before every install, swap::recover checks it. If the saved library already has the new files and SHA-256, the update is finished; otherwise it is undone. Undoing again after an interruption is safe.
  • The old files are deleted only after the library is saved. If a later step fails (the repo clone), the whole update is undone.
  • remove_dropped is now dropped (it returns the list and deletes nothing). updated_exe returns the old AppImage it replaces instead of deleting it. The old single-file build that used to be deleted before unpacking now goes through the swap too.
  • Never the player's files. Where the new release has a file and the game has a folder (not a Mac app), the folder is set aside only when everything in it is the old release's own (the record's files); the same for a file where the release has a folder. Otherwise the update stops before anything moves and names the folder or file as holding the player's own files. A link there (a release folder the player moved to another drive) is set aside as a link, as before, and what it points at is never touched. put_in_place takes the old release's file list for this.
  • Scans for the game's program, its setup and its saves skip the set-aside folder, and so does everything that counts or shows the game's folder as the game's while old files wait there for the next start: the game sizes on the Storage page (manage::game_size; moving the game still counts all of it), the check for the same game already in a new place, the settings files read for the player's copy, the Linux-program check, and the folder listing plugins get. Moving and uninstalling still take the whole folder.
  • Unchanged: mods, installer releases and unpacked game copies still use install::unpack + overlay.

Tests

  • swap.rs: failure after N moves for every N; launcher closed after N moves for every N, then recovered at start; closed right after writing the marker; closed after the record was saved (the update is finished); closed while undoing; a later step failing; locked file; a tampered marker pointing outside the game folder; dropped files outside the game folder; empty folders left by dropped files; a release file where the game has a folder of only old release files (goes ahead) or one with a player file (stops, nothing changed); the same for a release folder where the game has a file; a release folder where the game has a link to a folder outside it (Unix only: goes in, the link's target untouched); an update still counting after the library is saved and loaded again (nested paths, so Windows separators are covered).
  • install.rs: a staged zip update going in whole and keeping saves; the set-aside folder is never picked as the game's program.
  • manage.rs and lib.rs: a game's size leaves out what an update set aside (and moving still counts it); the same-game check ignores it.
  • Linux VM (Bazzite, distrobox): cargo test 747 passed, 0 failed; node --test tests/*.test.cjs 361 passed.
  • Windows 11 VM: the full cargo test passed (707), including the locked-file test with a real Windows lock (share_mode(0)) and the save-and-load check.
  • Not run: macOS (the bundle handling is covered by the cross-platform test with a Game.app folder), the Flatpak itself, and a real end-to-end update in the running app.

Patch notes

Player line: Game updates go in whole or not at all: if one is interrupted (a locked file, a full drive, the PC turning off), your game is left exactly as it was.

For the website (SDK guide), optional since no recomplauncher.json field changed: in "Releases that install cleanly", add that updates go in whole or not at all, and that files the last release had and the new one doesn't are taken away unless the game changed them.

swap.rs sets the old release's files aside in the game's folder, moves the new ones in, and puts everything back on any failure. A marker written first lets the next start finish or undo an update the launcher was closed in. Not wired into installs yet.
The release is unpacked beside the game first, then the old files it replaces or drops are set aside and the new ones moved in. A failure, or a later step like the repo clone failing, puts everything back and says what stopped it. The old files go only once the library is saved, and a launcher closed partway finishes or undoes the update at its next start. Scans for the program, setup, backups and saves skip the set-aside folder.
@Xarishark
Xarishark marked this pull request as draft November 19, 2026 00:40
@Xarishark
Xarishark marked this pull request as ready for review November 19, 2026 01:07
@elripalda
elripalda merged commit 1916103 into elripalda:main Nov 19, 2026
6 checks passed
Xarishark added a commit to Xarishark/RecompLauncher that referenced this pull request Nov 19, 2026
Brings in Beta 65, the game update rollback (elripalda#303), keeps_copy (elripalda#308) and the
developer guide additions (elripalda#311). Every language file gained texts on both sides
at its end; both are kept. The setup step keeps its temp folder, room check and
data folder, and takes main's prepare_args, so a run without the copy (keeps_copy)
gets them too. The "no prepare.done" warning stays quiet for a keeps_copy step,
which already gets its own more exact one.
@Xarishark
Xarishark deleted the feat/atomic-game-update branch November 23, 2026 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants