fix(saves): the save script's Linux backups go beside the saves, where the launcher keeps its own #1473

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

Type: fix · Risk: low · Tested on: Windows 11 and Linux (Ubuntu 24.04 under WSL), game-free · Needs: none

TL;DR

On Linux and the Steam Deck, the save script put its backups in a different folder from the launcher, so the launcher never saw them and a player looking for a backup could think it was gone. This PR makes the script back up into the launcher's folder, beside the saves. Backups already made stay where they are, and Windows is unchanged. New tests check the folder on Linux and Windows, and a copy's backup landing there.

Breakdown

  • Who it helps: Linux and Steam Deck players who copy saves with scripts/longshot_saves.py, and anyone who later needs one of those backups back.
  • What was wrong: the script's Linux default was ~/.local/share/oot-save-backups, while the launcher has used ~/.local/share/longshot/save-backup since LongshotLauncher#80.
  • What changes: a copy's backup on Linux now goes to ~/.local/share/longshot/save-backup, the same folder as the launcher's.
  • What does not change: Windows (%LOCALAPPDATA%\Longshot\oot-save-backups, already the launcher's), --backup-dir, the copies themselves, and every backup already on the disk (nothing is moved or deleted).
  • How it was checked: 4 new tests in tests/test_longshot_saves.py, passing on Linux and Windows (the 3 Linux ones fail on main's script); the rest of that file is unchanged on Linux (one error that main has too).
  • What is still open: the launcher listing the older oot-save-backups folder too (LongshotLauncher#188), and #1428's game backups using the same folder.
  • Risk: low: only where new backups go on Linux; a player who looks in the old folder for a new backup won't find it there (the docs say where it is).

Why

On Linux, save backups are split between two folders, and the launcher lists only one: the launcher writes $XDG_DATA_HOME/longshot/save-backup, while this script (and #1428's game backups) write $XDG_DATA_HOME/oot-save-backups. A player restoring a backup from the launcher (LongshotLauncher#182), or following docs/saves.md, doesn't see the script's. Windows has one folder for all of them already.

See MagicBeanDev/LongshotLauncher#188 (found in the review of MagicBeanDev/LongshotLauncher#182 (comment)).

How to reproduce

Seen on: Linux or Steam Deck, any GPU
Settings and switches: defaults
Steps: python -I scripts/longshot_saves.py import lichii (or any import or export) with no --backup-dir
Expected: the backup in the launcher's backups folder, ~/.local/share/longshot/save-backup/
Actual: the backup in ~/.local/share/oot-save-backups/, which the launcher doesn't read

What changed

The script's default backup folder on Linux is the launcher's. Nothing else in the copy changes, and the script never reads or lists backups, so there is nothing to read from the old folder.

  • script: default_backup_dir() in scripts/longshot_saves.py returns $XDG_DATA_HOME/longshot/save-backup on Linux (Windows unchanged), with the module docstring saying where older backups are.
  • docs: docs/saves-script.md (where a copy backs up, and where to delete old ones) and docs/saves.md's table row for Linux.
  • tests: a BackupFolder class in tests/test_longshot_saves.py: the Linux default with and without XDG_DATA_HOME, the Windows default unchanged, and an import with no --backup-dir backing up into longshot/save-backup while an old backup in oot-save-backups stays exactly as it was.

Measurements

Nothing to measure: a script's default folder and its tests, nothing the game runs.

Flags and settings

None.

Testing

Tested:

  • Linux (Ubuntu 24.04 under WSL, Python 3.12): python3 -I -B tests/test_longshot_saves.py: 67 tests, the 4 new ones pass; one error, Copy.test_old_save_that_cannot_be_deleted (a permission test), also fails on main on that PC (checked in a clean main worktree).
  • Windows 11 (Python 3.11): the 4 new tests pass (tests/test_longshot_saves.py BackupFolder). The rest of that file is Linux-only (RUN_ALL_SKIP on Windows).
  • python -I -B tests/run_all.py on Windows: 546 passed, 65 failed, 123 skipped (main @ 6438c2ef on the same PC: 544 passed, 67 failed). No check fails here that passes on main: every failure is one main has too (this PC has no llvm-mingw, Vulkan headers or spirv-val, which most of them need), and test_gpu_hang_watch and test_mesh_args_cleanup failed on main's run only (they vary between runs). tests/test_longshot_saves.py is skipped on Windows by its own RUN_ALL_SKIP, so it ran on Linux above.

Not tested: a real copy on a Steam Deck; the tests use temp folders standing in for the data folder.

Must be tested: None.

Risks

What could break: a script or habit that expects new backups in ~/.local/share/oot-save-backups on Linux; the docs now name the new folder.

Turning it off: --backup-dir ~/.local/share/oot-save-backups for one copy, or revert the commit.

Compatibility: Nothing changes for saves; backups already on the disk stay where they are. On Linux, new script backups appear in the launcher's backups folder.

Issues

See MagicBeanDev/LongshotLauncher#188

Related: #1428 (the game's own backups, WIP, also writes oot-save-backups on Linux) and #1397 (the script's Windows save folder; it edits the docstring lines just above this one, so whichever merges second has a one-line rebase).

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.
**Type:** fix · **Risk:** low · **Tested on:** Windows 11 and Linux (Ubuntu 24.04 under WSL), game-free · **Needs:** none ## TL;DR On Linux and the Steam Deck, the save script put its backups in a different folder from the launcher, so the launcher never saw them and a player looking for a backup could think it was gone. This PR makes the script back up into the launcher's folder, beside the saves. Backups already made stay where they are, and Windows is unchanged. New tests check the folder on Linux and Windows, and a copy's backup landing there. ## Breakdown - **Who it helps:** Linux and Steam Deck players who copy saves with `scripts/longshot_saves.py`, and anyone who later needs one of those backups back. - **What was wrong:** the script's Linux default was `~/.local/share/oot-save-backups`, while the launcher has used `~/.local/share/longshot/save-backup` since LongshotLauncher#80. - **What changes:** a copy's backup on Linux now goes to `~/.local/share/longshot/save-backup`, the same folder as the launcher's. - **What does not change:** Windows (`%LOCALAPPDATA%\Longshot\oot-save-backups`, already the launcher's), `--backup-dir`, the copies themselves, and every backup already on the disk (nothing is moved or deleted). - **How it was checked:** 4 new tests in `tests/test_longshot_saves.py`, passing on Linux and Windows (the 3 Linux ones fail on `main`'s script); the rest of that file is unchanged on Linux (one error that `main` has too). - **What is still open:** the launcher listing the older `oot-save-backups` folder too (LongshotLauncher#188), and #1428's game backups using the same folder. - **Risk:** low: only where new backups go on Linux; a player who looks in the old folder for a new backup won't find it there (the docs say where it is). ## Why On Linux, save backups are split between two folders, and the launcher lists only one: the launcher writes `$XDG_DATA_HOME/longshot/save-backup`, while this script (and #1428's game backups) write `$XDG_DATA_HOME/oot-save-backups`. A player restoring a backup from the launcher (LongshotLauncher#182), or following docs/saves.md, doesn't see the script's. Windows has one folder for all of them already. See https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/issues/188 (found in the review of https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/182#issuecomment-45174). ## How to reproduce **Seen on:** Linux or Steam Deck, any GPU **Settings and switches:** defaults **Steps:** `python -I scripts/longshot_saves.py import lichii` (or any import or export) with no `--backup-dir` **Expected:** the backup in the launcher's backups folder, `~/.local/share/longshot/save-backup/` **Actual:** the backup in `~/.local/share/oot-save-backups/`, which the launcher doesn't read ## What changed The script's default backup folder on Linux is the launcher's. Nothing else in the copy changes, and the script never reads or lists backups, so there is nothing to read from the old folder. - script: `default_backup_dir()` in `scripts/longshot_saves.py` returns `$XDG_DATA_HOME/longshot/save-backup` on Linux (Windows unchanged), with the module docstring saying where older backups are. - docs: `docs/saves-script.md` (where a copy backs up, and where to delete old ones) and `docs/saves.md`'s table row for Linux. - tests: a `BackupFolder` class in `tests/test_longshot_saves.py`: the Linux default with and without `XDG_DATA_HOME`, the Windows default unchanged, and an import with no `--backup-dir` backing up into `longshot/save-backup` while an old backup in `oot-save-backups` stays exactly as it was. ## Measurements Nothing to measure: a script's default folder and its tests, nothing the game runs. ### Flags and settings None. ## Testing **Tested:** - Linux (Ubuntu 24.04 under WSL, Python 3.12): `python3 -I -B tests/test_longshot_saves.py`: 67 tests, the 4 new ones pass; one error, `Copy.test_old_save_that_cannot_be_deleted` (a permission test), also fails on `main` on that PC (checked in a clean `main` worktree). - Windows 11 (Python 3.11): the 4 new tests pass (`tests/test_longshot_saves.py BackupFolder`). The rest of that file is Linux-only (`RUN_ALL_SKIP` on Windows). - `python -I -B tests/run_all.py` on Windows: 546 passed, 65 failed, 123 skipped (main @ 6438c2ef on the same PC: 544 passed, 67 failed). No check fails here that passes on main: every failure is one main has too (this PC has no llvm-mingw, Vulkan headers or spirv-val, which most of them need), and test_gpu_hang_watch and test_mesh_args_cleanup failed on main's run only (they vary between runs). `tests/test_longshot_saves.py` is skipped on Windows by its own RUN_ALL_SKIP, so it ran on Linux above. **Not tested:** a real copy on a Steam Deck; the tests use temp folders standing in for the data folder. **Must be tested:** None. ## Risks **What could break:** a script or habit that expects new backups in `~/.local/share/oot-save-backups` on Linux; the docs now name the new folder. **Turning it off:** `--backup-dir ~/.local/share/oot-save-backups` for one copy, or revert the commit. **Compatibility:** Nothing changes for saves; backups already on the disk stay where they are. On Linux, new script backups appear in the launcher's backups folder. ## Issues See https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/issues/188 Related: https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1428 (the game's own backups, WIP, also writes `oot-save-backups` on Linux) and https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1397 (the script's Windows save folder; it edits the docstring lines just above this one, so whichever merges second has a one-line rebase). ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated.
fix(saves): the save script's Linux backups go beside the saves, where the launcher keeps its own
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 15s
Third-party parts / As their notes say (pull_request) Successful in 22s
PR description / Description follows the template (pull_request_target) Successful in 5s
a79f8860ee
On Linux, scripts/longshot_saves.py backed a copy up to $XDG_DATA_HOME/oot-save-backups,
while the launcher has kept its backups in $XDG_DATA_HOME/longshot/save-backup since
LongshotLauncher#80, so the launcher never saw the script's. The default is now the
launcher's folder; --backup-dir and Windows are unchanged, and backups already in
oot-save-backups stay where they are.

Part of MagicBeanDev/LongshotLauncher#188: MagicBeanDev/LongshotLauncher#188

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
dyst changed title from WIP: fix(saves): the save script's Linux backups go beside the saves, where the launcher keeps its own to fix(saves): the save script's Linux backups go beside the saves, where the launcher keeps its own 2026-11-17 22:02:25 +00:00
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 15s
Third-party parts / As their notes say (pull_request) Successful in 22s
PR description / Description follows the template (pull_request_target) Successful in 5s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
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-folder:dyst-fix/linux-backup-folder'
git switch 'dyst-fix/linux-backup-folder'
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/Longshot!1473
No description provided.