Skip to content

fix(package): Search per-platform data directories for Character Packages - #1207

Merged
omesser merged 2 commits into
mainfrom
cursor/per-platform-character-search-b00a
Oct 1, 2026
Merged

omesser merged 2 commits into
mainfrom
cursor/per-platform-character-search-b00a

Conversation

@omesser

@omesser omesser commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Why

package::search_paths built the user character directory as $HOME/Library/Application Support/fidget/characters on every OS. That path is the macOS convention. Linux looked in a folder nothing else uses. Windows usually has no HOME, so the user directory was missing. FIDGET_CHARACTERS replaced every other search path.

What changed

FIDGET_CHARACTERS is additive. If it is set, fidget searches those directories first. Split entries with : on macOS and Linux, and with ; on Windows. Fidget adds them in front of the other directories, the way PATH works, so the user directory and the shipped packages stay findable.

The rest of the search, in order:

  1. memory::data_dir()/characters. This is the same per-platform data directory as settings.json. macOS uses ~/Library/Application Support/fidget/characters. Linux uses $XDG_DATA_HOME/fidget/characters, or ~/.local/share/fidget/characters when that variable is unset. Windows uses %APPDATA%\fidget\characters.
  2. On Linux, each $XDG_DATA_DIRS entry under fidget/characters. Unset or empty means /usr/local/share/fidget/characters, then /usr/share/fidget/characters. Fidget skips a relative entry.
  3. The bundled characters/ directory.

An earlier directory wins when two packages share a name. A character switch loads that earlier package.

The Settings Character picker shows the user directory it reads. docs/DEVELOPMENT.md lists the resolved path per platform.

How to verify

cargo test -p fidget --bin fidget -- search_paths fidget_characters windows_search linux_search macos_search an_empty_fidget the_character_picker the_running_character
node --test tests/settings.test.js

windows_search_paths_keep_the_user_directory_without_home covers Windows with HOME unset. The search reads the roaming data directory and does not read HOME, so that test runs on Linux and macOS too.

Notes

The Settings window was not opened. The picker text is the form description the webview draws as help under the Character popup. The form tests and tests/settings.test.js cover that text.

Closes #1189

— Cursor agent (Coder), on @omesser's behalf.

Open in Web Open in Cursor 

…ages

Co-authored-by: Oded Messer <odedmesser@gmail.com>

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soft-gate — PR #1207

Tip gated: 0cfb85be0643166e7dacd63849d11552ca0af7da (cursor/per-platform-character-search-b00a)
Draft: no · Mergeable: yes (mergeable_state clean/unstable→settled) · Closes #1189: yes

Hard — Holds

  • Bundled characters/ stays last in search_paths; still resolved.
  • Character switch / load_all_characters: earlier directory wins via cache.contains_key skip — user packages not overwritten by bundled duplicates.
  • Additive FIDGET_CHARACTERS prepends then keeps memory::data_dir()/characters + bundled (empty/unset extras add nothing).
  • Windows path no longer depends on HOME; uses data_dir (APPDATA). Tests assert no literal Library component on Windows/Linux hosts.

Soft ledger

Item Status Evidence
(a) #1189 acceptance Holds Order: additive FIDGET_CHARACTERS (platform sep) → memory::data_dir()/characters → Linux XDG_DATA_DIRS fidget/characters (skip relative; unset/empty → /usr/local/share then /usr/share) → bundled. Earlier wins. Closes #1189.
(b) Per-platform correctness Holds macOS App Support via data_dir; Linux XDG_DATA_HOME + XDG_DATA_DIRS; Windows APPDATA; no production ~/Library/... hardcode (only test fixtures / macOS data_dir literals).
(c) Tests + Settings UX Holds Unit tests per desktop + empty FIDGET + Windows-without-HOME + Linux host assertion; picker help shows user_characters_dir(); fixtures updated; DEVELOPMENT.md table.
(d) Merge hygiene Holds mergeable: true vs main @ 397ac6cc.
(e) CI on tip Holds Tip checks: build success, checks (ubuntu-latest) success, checks (macos-latest) success, windows success, deploy skipped. No red.
(f) FIDGET_CHARACTERS behavior Holds Replacement → additive (PATH-like) is intentional per #1189 (“additive matches how PATH-style variables behave”) and documented in PR body + DEVELOPMENT.md. Scripts that relied on exclusive override to hide bundled/user paths would now still see them — documented; no exclusive override needed for acceptance.

Local verify (box)

  • node --test tests/settings.test.js → 34/34 pass
  • Named cargo test -p fidget --bin fidget -- … → skipped (box missing pkg-config / GTK build deps; apt mirror 500). Rely on CI green for Rust filter.

Verdict

Soft CLEARED · Hard Holds · COMMENT review only (no approve, no merge).

— Cursor agent (Architect), on @omesser's behalf.

Keep the notes that stop a reader replacing FIDGET_CHARACTERS, dropping the dead_code allows, or letting a later package win a switch.

Co-authored-by: Oded Messer <odedmesser@gmail.com>

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soft-re-gate CLEARED @ 38ed8b71fde57fda6ef61127eb4b2a554e18cc41

vs prior Soft-CLEARED 0cfb85be0643166e7dacd63849d11552ca0af7da (COMMENT 5373212702): tip moved +1 commit chore(package): Cut comments that restate the character search — comment/docstring trim only in package.rs + settings/form.rs (−35/+5). No behavior/path/test/logic change.

Draft: no · Mergeable: yes · mergeStateStatus: UNSTABLE (CI settling) · Closes #1189: yes · base main @ 2321ea7a

Soft ledger

Item Status Evidence
(a) #1189 acceptance Met Order: additive FIDGET_CHARACTERS → memory::data_dir()/characters → Linux XDG → bundled; earlier wins; issue Closes linked.
(b) Per-platform paths Met macOS App Support via data_dir; Linux XDG_DATA_HOME + XDG_DATA_DIRS; Windows APPDATA; user_characters_dir() = data_dir()/characters.
(c) Tests + Settings picker Met macos_search / linux_search / windows_search / fidget_characters_* / empty-extra tests intact; picker help shows characters_dir; form + fixture coverage.
(d) Merge hygiene Met MERGEABLE vs main; Closes #1189; no dirty conflict (UNSTABLE = checks, not CONFLICTING).
(e) CI Met (pending OK) tip: build success; deploy skipped; checks (ubuntu/macos) + windows in_progress — no failures.
(f) FIDGET_CHARACTERS additive Met Prepends via split_list; empty/unset adds nothing; user + bundled stay.

Hard

none — bundled last; additive extras keep user+bundled; windows_search_paths_keep_the_user_directory_without_home still asserts APPDATA path without HOME/Library.

Next: await Oded merge yes (COMMENT only; no approve/merge).

— Cursor agent (Architect), on @omesser's behalf.

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.

fix(package): Search per-platform data directories for Character Packages

2 participants