Skip to content

feat: migrate to XDG/FHS install locations#23

Merged
ukanga merged 1 commit into
pld:mainfrom
ukanga:issue-22-install-locations
May 17, 2026
Merged

feat: migrate to XDG/FHS install locations#23
ukanga merged 1 commit into
pld:mainfrom
ukanga:issue-22-install-locations

Conversation

@ukanga
Copy link
Copy Markdown
Collaborator

@ukanga ukanga commented May 10, 2026

Closes #21.

Summary

  • Binary moves from ~/.wt/wt (shell alias) to ~/.local/bin/wt (on PATH)
  • Global config moves from ~/.wt/config.toml to $XDG_CONFIG_HOME/wt/config.toml (default ~/.config/wt/)
  • Session state moves from ~/.wt/sessions.json to $XDG_STATE_HOME/wt/sessions.json (default ~/.local/state/wt/)
  • macOS gets the same XDG paths, not ~/Library/Application Support/

Changes

src/config.rs / src/session.rs: Hand-rolled xdg_config_home() / xdg_state_home() helpers (avoids dirs::config_dir() / dirs::state_dir() which return Apple paths on macOS). Legacy ~/.wt/ paths are read as a fallback with a one-time stderr notice; writes always go to the new locations.

install.sh: Installs to ~/.local/bin/wt by default. --system flag installs to /usr/local/bin/wt (with sudo). Alias-writing block removed entirely. Re-running the installer migrates legacy files, removes stale shell aliases from rc files, and cleans up ~/.wt/ if empty. Prints a one-line PATH instruction if the install dir is not on $PATH (macOS).

README.md: Updated Installation and Configuration sections.

Test plan

  • Fresh install (no ~/.wt/): binary at ~/.local/bin/wt, nothing written under ~/.wt/
  • ./install.sh --system installs to /usr/local/bin/wt
  • New config/state files land at ~/.config/wt/ and ~/.local/state/wt/
  • Existing user re-runs installer: files migrated, ~/.wt/ removed, aliases stripped from rc files, which wt resolves to new path
  • Re-running installer after migration is idempotent (exit 0, no duplicates)
  • XDG_CONFIG_HOME / XDG_STATE_HOME env vars honoured
  • Legacy-only user (no re-install): wt reads from ~/.wt/ with deprecation notice
  • cargo test passes (60 unit + integration tests including new XDG and legacy-fallback tests)

@ukanga ukanga force-pushed the issue-22-install-locations branch 3 times, most recently from 50b8b72 to db2ba0f Compare May 10, 2026 18:16
- Move config and state files to XDG base directories
- Install binary to ~/.local/bin with migration from ~/.wt/bin
- Add --system flag for system-wide installation
- Update installation and configuration docs for XDG paths
@ukanga ukanga force-pushed the issue-22-install-locations branch from db2ba0f to 1706a55 Compare May 17, 2026 11:07
@ukanga ukanga merged commit 81eae95 into pld:main May 17, 2026
1 check passed
@ukanga ukanga deleted the issue-22-install-locations branch May 17, 2026 11:08
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.

Install binary, config, and state to standard XDG / FHS locations

1 participant