Skip to content

Import Add-ons…: every add-on in a folder at once (Linux, Windows, macOS) - #139

Merged
brahm merged 2 commits into
mainfrom
claude/project-thread-t6nrhz
Oct 30, 2026
Merged

brahm merged 2 commits into
mainfrom
claude/project-thread-t6nrhz

Conversation

@brahm

@brahm brahm commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Requested by Brahm · project thread

What it does

A new menu item, Import Add-ons… (main menu on Linux, More menu on Windows, File menu on the Mac), takes a folder and imports every add-on in it in one go:

  • Reads the folder, its subfolders and the ZIP archives in it (also ZIPs inside ZIPs, up to three levels), as the community shared the add-ons.
  • Identifies each .xpx/.xpt by what it holds (Expansion or Core Rules 2.0, and which categories, for example "Expansion: Classes 1, Class Abilities 62").
  • Validates before writing: it refuses damaged files, empty packages and Expansion packages on a Core Rules 2.0 installation, and imports a file found twice only once. The list before Import shows all of this, with the reasons.
  • Imports everything after one confirmation. It first backs up UserDbas and Chars beside the data folder. Packages go in from the oldest file to the newest, so the newer one wins on a name clash. Characters already in the list are left out, so a second run does not duplicate them. The .bmp pictures are copied to where the imported records look for them, or to the place a pictures.tsv beside them gives, and never over an existing file. A log is written.

Code

  • cr-app/src/addons.rs: all the logic (scan, groups/notes/summary text, import, report, log), with tests. This adds the zip dependency (deflate only).
  • cr-store: import_named keeps the chosen items in a HashSet. With a Vec the check was quadratic on a 36k-item package.
  • GTK: a list dialog, then a progress bar with the package being imported, then the report.
  • Windows: the read runs on the folder dialog's thread, then a ContentDialog with the summary, a busy notice and the report.
  • macOS: AddonsSession in the bridge, and an AddonsView sheet (Addons.swift).
  • New action IMPORT_ADDONS on every app. Translations are in all six languages, and the README has a paragraph on it.

Tested

  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings and cargo test --workspace pass. cargo clippy -p cr-win -p cr-app -p cr-mac-ffi --target x86_64-pc-windows-msvc also passes (check only). The Swift code is not compiled here; the macOS CI job builds it.
  • 88 real community add-ons (Classes and Birthright folders, as ZIPs, plus a loose .XPX and a damaged file): 2,706 items, 5 characters and 4 pictures came in. The duplicate and the damaged file were reported. Run with CORERULES_DIR=… CORERULES_ADDONS=… cargo test -p cr-app addons.
  • The consolidated Comunidade.xpx in a ZIP with its 668 pictures and a pictures.tsv: 36,525 items, 48 characters and 537 pictures. A second run brings no characters.
  • The GTK app run end to end under Xvfb, in Portuguese.

Generated by Claude Code

…and macOS

A new menu item reads a folder with its subfolders and the ZIP archives
in it (nested up to three deep), tells each .xpx and .xpt package by what
it holds, refuses what cannot come in (damaged, empty, Expansion packages
on Core Rules 2.0) and imports the same file found twice only once. The
list before the import says what comes in and why the rest does not.

Import backs up UserDbas and Chars beside the data folder, imports the
packages from the oldest file to the newest, leaves out characters
already in the list, copies the .bmp pictures to where the imported
records look for them (or where a pictures.tsv places them) and writes a
log. The logic is in cr_app::addons; the GNOME app shows the list and a
progress bar, the Windows app and the Mac app a dialog and a sheet.

Import in cr-store keeps the chosen items in a set, as a package holds
tens of thousands of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NiPLVSzvK27vd8v2rbXNs7
@brahm brahm self-assigned this Oct 29, 2026
The switch on the sheet in front had no case for it, which Swift refuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NiPLVSzvK27vd8v2rbXNs7
@brahm
brahm merged commit 05a4e7c into main Oct 30, 2026
3 checks passed
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