fix(saves): on Linux, Restore from a backup lists the older oot-save-backups folder too #190

Open
dyst wants to merge 1 commit from dyst/LongshotLauncher:fix/linux-backup-folders into main
Member

On Linux, Restore from a backup only read the launcher's own backups folder, so the backups players most likely want back were missing from it: the launcher's own from before #80, the ones Longshot's scripts/longshot_saves.py makes, and the game's own (Longshot#1428). They all sit in the older $XDG_DATA_HOME/oot-save-backups. Now the list reads both folders.

Part of #188 (#188); Longshot's script part is a separate Longshot PR.

Builds on #182 (restore from a backup), now merged. Merge order: this one, then #184, #185.

What changes

  • Linux reads two folders: $XDG_DATA_HOME/longshot/save-backup (Saves.BackupRoot, where the launcher's backups have gone since #80 and keep going) and $XDG_DATA_HOME/oot-save-backups (OldLinuxBackups). XDG_DATA_HOME unset means ~/.local/share, as before.
  • Each row says which folder: on Linux the summary line ends with "· in ~/.local/share/oot-save-backups" (or the launcher's folder). Two backups with the same name, one in each folder, are two rows.
  • Nothing is moved or deleted. The old folder is only read. A restore from it works the same, and Longshot's save is backed up first into the launcher's own folder, as for every restore.
  • Unchanged: Windows, where the launcher, the script and the game already share one folder; and a portable launcher, which reads and writes its own save-backups/ only.
  • Where each kind is: BackupRoot's comment no longer says the script's and the launcher's backups are in one place. docs/saves.md gains a table of where each kind of backup is on each system.

How

  • SaveEnvironment.BackupRoots (Linux: BackupRoot, then OldLinuxBackups; Windows or portable: BackupRoot alone) and OldLinuxBackups. Nothing that writes a backup changed: they all still use BackupRoot.
  • SaveBackups.List reads every root; BackupSave.Root names the folder a row is in; the backups page adds "in {0}" to a row's summary when there are two folders. One new text, written in the 12 full catalogs (needs a native speaker's check).
  • tools/screenshots: saves-backups-linux, a backup in each folder.

Testing

  • python -I tests/test_launcher_core.py: 1908 checks passed (new, in SaveBackupsChecks: the roots on Linux with and without XDG_DATA_HOME, on Windows, and for a portable launcher; backups in each Linux folder listed in order with their folder; the same name in both folders is two rows; neither Windows nor a portable launcher reads the Linux folders; a restore from the old folder works, backs Longshot's save up into the launcher's folder, and leaves the old folder exactly as it was; a gather's backup in the old folder restores too).
  • python -I tests/test_release.py: 37 tests OK. dotnet build App -c Release and tools/screenshots: 0 warnings, 0 errors.
  • Not done: a run on a real Linux PC (Windows 11 here; the Linux paths are exercised by the checks through SaveEnvironment, and the screenshot is drawn headless with a Linux environment).

Screenshots, Before / After: in the first comment.

On Linux, Restore from a backup only read the launcher's own backups folder, so the backups players most likely want back were missing from it: the launcher's own from before #80, the ones Longshot's `scripts/longshot_saves.py` makes, and the game's own (Longshot#1428). They all sit in the older `$XDG_DATA_HOME/oot-save-backups`. Now the list reads both folders. Part of #188 (https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/issues/188); Longshot's script part is a separate Longshot PR. Builds on #182 (restore from a backup), now merged. Merge order: this one, then #184, #185. ## What changes - **Linux reads two folders:** `$XDG_DATA_HOME/longshot/save-backup` (`Saves.BackupRoot`, where the launcher's backups have gone since #80 and keep going) and `$XDG_DATA_HOME/oot-save-backups` (`OldLinuxBackups`). `XDG_DATA_HOME` unset means `~/.local/share`, as before. - **Each row says which folder:** on Linux the summary line ends with "· in ~/.local/share/oot-save-backups" (or the launcher's folder). Two backups with the same name, one in each folder, are two rows. - **Nothing is moved or deleted.** The old folder is only read. A restore from it works the same, and Longshot's save is backed up first into the launcher's own folder, as for every restore. - **Unchanged:** Windows, where the launcher, the script and the game already share one folder; and a portable launcher, which reads and writes its own `save-backups/` only. - **Where each kind is:** `BackupRoot`'s comment no longer says the script's and the launcher's backups are in one place. `docs/saves.md` gains a table of where each kind of backup is on each system. ## How - `SaveEnvironment.BackupRoots` (Linux: `BackupRoot`, then `OldLinuxBackups`; Windows or portable: `BackupRoot` alone) and `OldLinuxBackups`. Nothing that writes a backup changed: they all still use `BackupRoot`. - `SaveBackups.List` reads every root; `BackupSave.Root` names the folder a row is in; the backups page adds "in {0}" to a row's summary when there are two folders. One new text, written in the 12 full catalogs (needs a native speaker's check). - `tools/screenshots`: `saves-backups-linux`, a backup in each folder. ## Testing - `python -I tests/test_launcher_core.py`: 1908 checks passed (new, in `SaveBackupsChecks`: the roots on Linux with and without `XDG_DATA_HOME`, on Windows, and for a portable launcher; backups in each Linux folder listed in order with their folder; the same name in both folders is two rows; neither Windows nor a portable launcher reads the Linux folders; a restore from the old folder works, backs Longshot's save up into the launcher's folder, and leaves the old folder exactly as it was; a gather's backup in the old folder restores too). - `python -I tests/test_release.py`: 37 tests OK. `dotnet build App -c Release` and `tools/screenshots`: 0 warnings, 0 errors. - **Not done:** a run on a real Linux PC (Windows 11 here; the Linux paths are exercised by the checks through `SaveEnvironment`, and the screenshot is drawn headless with a Linux environment). Screenshots, Before / After: in the first comment.
Every copy backs up what it replaces, but getting a backup back meant copying folders by hand. The Saves page gains
"Restore from a backup…" (under the slots): a page listing every save in the backups folder, newest first, with what
made it (an import, an export, Hookshot's import, the versions' saves brought together, a version deleted), when, its
slots and its size, the folder of each one a click away. Restore… opens the import's confirmation: the backup's slots,
what they replace, Keep Longshot's game settings, and Longshot's own save backed up first (restore-backup-<stamp>).
The backup itself is only read; nothing on the page deletes one.

Core/SaveBackups.cs with tests/launcher_core/SaveBackupsChecks.cs; SaveMode.Restore through the confirm and result
pages; App/Views/BackupsView.axaml; the backup scenes in tools/screenshots; docs/saves.md "Restore from a backup"; the
new texts in the 12 full catalogs. Stacked on the .zip export and import.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(saves): a backup with several profiles lists the game's alone, or names each; review of #182
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
a2617e645e
- A backup (or a gather's or delete's version folder) that holds several profiles listed each under the same label, and any
  of them restored into the game's profile. Now the game's profile (Saves.UserId) is listed alone when it is there; else
  each profile is listed with its id in the row, " (profile …)", as the import names one.
- An export's backup says it restores into Longshot: its row ("…, to restore into Longshot") and its confirm's title
  ("Restore Lichii's old save into Longshot").
- The replaced text names only the files the source has (a backup with no account.sav or option.sav leaves Longshot's);
  the settings tick is hidden when the source has no option.sav, since it would change nothing.
- A gather's "shared (set aside)" folder reads as the shared save. Back on a restore's confirm returns to the backups list.
- docs/saves.md: one row a save the game would open; a whole save folder's import is undone only in part by a restore.
- Checks: a whole-folder backup with a stray profile, a version folder with two profiles and one with the game's, an
  export's backup restored into Longshot, a backup with no account.sav or option.sav. The scene's backups gain an export.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(saves): on Linux, Restore from a backup lists the older oot-save-backups folder too
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
bc55dac5c9
On Linux the launcher's backups have gone to $XDG_DATA_HOME/longshot/save-backup since #80, but the launcher's own from
before that, Longshot's scripts/longshot_saves.py's and the game's own (Longshot#1428) are in $XDG_DATA_HOME/oot-save-backups,
which Restore from a backup did not read. SaveEnvironment.BackupRoots now lists both on Linux (BackupRoot first, where new
backups keep going); SaveBackups.List reads every one, and each row says which folder it is in. Nothing is moved or
deleted, the old folder is only read, and a restore from it backs Longshot's save up into the launcher's folder. Windows
(one folder) and a portable launcher (its own save-backups/) are unchanged. BackupRoot's comment no longer claims the
script's and the launcher's backups are in one place; docs/saves.md says where each kind is on each system.

Fixes #188 (the launcher's part; Longshot's script part is a separate Longshot PR).

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Restore from a backup on Linux, from tools/screenshots (headless, a Linux environment drawn on Windows, so the paths read D:\… where a Linux PC shows ~/.local/share/…): one backup in the launcher's longshot/save-backup, two in the older oot-save-backups (an export's, and a gather's from a month ago). Before: #182 (a2617e6); After: this PR (bc55dac).

Before (the old folder is not read) After (both folders, each row says which)
before after
Restore from a backup on Linux, from `tools/screenshots` (headless, a Linux environment drawn on Windows, so the paths read `D:\…` where a Linux PC shows `~/.local/share/…`): one backup in the launcher's `longshot/save-backup`, two in the older `oot-save-backups` (an export's, and a gather's from a month ago). Before: #182 (a2617e6); After: this PR (bc55dac). | Before (the old folder is not read) | After (both folders, each row says which) | |---|---| | ![before](https://git.magicbean.dev/attachments/58ff9c7e-8c6b-4f68-9976-a8a00afecb07) | ![after](https://git.magicbean.dev/attachments/c46989ba-447c-4b1c-b1a6-674634f62007) |
dyst force-pushed fix/linux-backup-folders from bc55dac5c9
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
to 5802ebe95e
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
2026-11-17 22:09:32 +00:00
Compare
Author
Member

Rebased onto main (12fd3af) now that #182 is merged: this PR is its own commit only. The files are identical to the previous head (bc55dac), so the earlier checks stand. Merge order: this, #184, #185.

Rebased onto main (12fd3af) now that #182 is merged: this PR is its own commit only. The files are identical to the previous head (bc55dac), so the earlier checks stand. Merge order: this, #184, #185.
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/linux-backup-folders:dyst-fix/linux-backup-folders'
git switch 'dyst-fix/linux-backup-folders'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!190
No description provided.