[PR #2593] [MERGED] Launcher: worlds of an instance, with backup, copy and delete #4457

Closed
opened 2026-11-03 04:17:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2593
Author: @ludovic111
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-worlds


📝 Commits (1)

  • c70e2fa Launcher: worlds of an instance, with backup, copy and delete

📊 Changes

11 files changed (+1111 additions, -6 deletions)

View changed files

📝 docs/launcher-commands.md (+43 -0)
📝 launcher/Cargo.lock (+219 -6)
📝 launcher/Cargo.toml (+6 -0)
📝 launcher/README.md (+7 -0)
📝 launcher/src/cli.rs (+100 -0)
📝 launcher/src/cli_tools.rs (+1 -0)
📝 launcher/src/lib.rs (+1 -0)
📝 launcher/src/main.rs (+9 -0)
➕ launcher/src/worlds.rs (+270 -0)
➕ launcher/src/worlds/tests.rs (+157 -0)
➕ launcher/src/worlds_page.rs (+298 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read.

Stacked on #2591 (version per instance), with it as its base: merge #2587, #2590, #2591, then this one.

What

Launcher feature 3 of 20: worlds in the launcher, for the selected instance.

  • launcher/src/worlds.rs: lists saves/ from each level.dat (gzip NBT, read with horizon-world's reader rather than a second NBT parser): LevelName (else the folder), mode from GameType and hardcore (difficulty_settings.hardcore in 26.3, Data.hardcore in older saves), LastPlayed, Version.Name, size on disk, icon.png. Newest first.
  • Back up: as vanilla's Make Backup (LevelStorageAccess.makeWorldBackup, read with tools/rea_vanilla.py): <game folder>/backups/<yyyy-MM-dd_HH-mm-ss>_<folder>.zip, entries under <folder>/, session.lock left out, a taken name gets (1), (2) (FileUtil.findAvailableName).
  • Copy: <name> (1), (2)… beside it, with that name written into the copy's LevelName so the game's list tells them apart; session.lock isn't copied.
  • Delete: to the system's trash (crate trash, MIT), after a "Move it to the trash?" confirmation. On macOS it uses the file manager call, not the crate's default Finder AppleScript, which would first ask the player to let the launcher control Finder.
  • Open folder, and "Open backups" after a backup. Sizes are read and copies made in the background; the list re-reads after a game exits.
  • CLI: horizon-launcher worlds [list|backup|copy|delete] <world> [--instance <name>]; MCP gets worlds_* from it, worlds_delete needs confirm: true.

New dependencies: horizon-world (path), trash 5, chrono 0.4 (local time in backup names; already in the lock through trash). Cargo.lock +218 lines of that.

Worlds
Delete
Deleted

How tested

launcher$ cargo fmt --check                                                    ok
launcher$ cargo clippy --all-targets --locked --features gpui/runtime_shaders -- -D warnings   ok
launcher$ cargo test --locked --features gpui/runtime_shaders                  lib 145 passed, bin 35 passed

New tests (worlds::tests): the list's fields from real gzip level.dat files (26.3 and old hardcore, no LevelName, a folder without level.dat); a backup's name, the second one in the same second, its entries without session.lock and their bytes; copies' folder and LevelName, a world whose folder differs from its name, unsafe names.

On the Mac mini (scratch homes, worlds written as gzip NBT): CLI list / backup / copy / delete (the folder went to the Trash); in the window: Back up (zip made, "Castle build backed up. Open backups"), Delete → Move to trash (gone from saves/, in the Trash). Two bugs found that way and fixed here: a copy of a world whose folder isn't its name kept the same name; the page jumped to the top while the list was read again.

Not run on Linux or Windows (the trash crate uses the freedesktop trash and the shell's recycle bin there); CI builds both.

Needs Ludovic

Nothing.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2593 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-worlds` --- ### 📝 Commits (1) - [`c70e2fa`](https://github.com/horizon-rust/horizon/commit/c70e2fae7411ab094c5f5a37d186dab9ee7c1b9e) Launcher: worlds of an instance, with backup, copy and delete ### 📊 Changes **11 files changed** (+1111 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+43 -0) 📝 `launcher/Cargo.lock` (+219 -6) 📝 `launcher/Cargo.toml` (+6 -0) 📝 `launcher/README.md` (+7 -0) 📝 `launcher/src/cli.rs` (+100 -0) 📝 `launcher/src/cli_tools.rs` (+1 -0) 📝 `launcher/src/lib.rs` (+1 -0) 📝 `launcher/src/main.rs` (+9 -0) ➕ `launcher/src/worlds.rs` (+270 -0) ➕ `launcher/src/worlds/tests.rs` (+157 -0) ➕ `launcher/src/worlds_page.rs` (+298 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read. Stacked on #2591 (version per instance), with it as its base: merge #2587, #2590, #2591, then this one. ## What Launcher feature 3 of 20: **worlds in the launcher**, for the selected instance. - `launcher/src/worlds.rs`: lists `saves/` from each `level.dat` (gzip NBT, read with `horizon-world`'s reader rather than a second NBT parser): `LevelName` (else the folder), mode from `GameType` and hardcore (`difficulty_settings.hardcore` in 26.3, `Data.hardcore` in older saves), `LastPlayed`, `Version.Name`, size on disk, `icon.png`. Newest first. - **Back up**: as vanilla's Make Backup (`LevelStorageAccess.makeWorldBackup`, read with tools/rea_vanilla.py): `<game folder>/backups/<yyyy-MM-dd_HH-mm-ss>_<folder>.zip`, entries under `<folder>/`, `session.lock` left out, a taken name gets ` (1)`, ` (2)` (`FileUtil.findAvailableName`). - **Copy**: `<name> (1)`, `(2)`… beside it, with that name written into the copy's `LevelName` so the game's list tells them apart; `session.lock` isn't copied. - **Delete**: to the system's trash (crate `trash`, MIT), after a "Move it to the trash?" confirmation. On macOS it uses the file manager call, not the crate's default Finder AppleScript, which would first ask the player to let the launcher control Finder. - **Open folder**, and "Open backups" after a backup. Sizes are read and copies made in the background; the list re-reads after a game exits. - CLI: `horizon-launcher worlds [list|backup|copy|delete] <world> [--instance <name>]`; MCP gets `worlds_*` from it, `worlds_delete` needs `confirm: true`. New dependencies: `horizon-world` (path), `trash` 5, `chrono` 0.4 (local time in backup names; already in the lock through `trash`). Cargo.lock +218 lines of that. ![Worlds](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/worlds/worlds.png) ![Delete](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/worlds/confirm.png) ![Deleted](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/worlds/deleted.png) ## How tested ``` launcher$ cargo fmt --check ok launcher$ cargo clippy --all-targets --locked --features gpui/runtime_shaders -- -D warnings ok launcher$ cargo test --locked --features gpui/runtime_shaders lib 145 passed, bin 35 passed ``` New tests (`worlds::tests`): the list's fields from real gzip level.dat files (26.3 and old hardcore, no LevelName, a folder without level.dat); a backup's name, the second one in the same second, its entries without `session.lock` and their bytes; copies' folder and LevelName, a world whose folder differs from its name, unsafe names. On the Mac mini (scratch homes, worlds written as gzip NBT): CLI list / backup / copy / delete (the folder went to the Trash); in the window: Back up (zip made, "Castle build backed up. Open backups"), Delete → Move to trash (gone from `saves/`, in the Trash). Two bugs found that way and fixed here: a copy of a world whose folder isn't its name kept the same name; the page jumped to the top while the list was read again. Not run on Linux or Windows (the trash crate uses the freedesktop trash and the shell's recycle bin there); CI builds both. ## Needs Ludovic Nothing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17:17 +07:00
Sign in to join this conversation.
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
horizon-rust/horizon#4457
No description provided.