fix(os): find in-repo resources from release builds run in the workspace

Testing with a real user config showed that `target/release/ghostty` and
`target/production/ghostty` (also `cargo run --profile production`, which
the README recommends) silently ran without resources: the configured
theme was not applied, bash shell integration was disabled ("no resources
dir set") so tab titles, the prompt cursor and cwd inheritance for new
tabs/splits broke, and terminfo was missing.

Zig never hits this because `zig build` installs `zig-out/share/ghostty`
next to `zig-out/bin`, which the exe-relative sentinel search finds. Cargo
has no such tree; the Rust-specific fallback to `<workspace>/resources`
was limited to the dev profile. It now applies to every profile. It only
triggers when the exe lives inside the workspace it was built from, after
GHOSTTY_RESOURCES_DIR and the share/ sentinel search, so installed
binaries are unaffected.

Test Plan:
- cargo test -p ghostty-os (dev_fallback_finds_workspace_resources now
  covers release builds and env precedence)
- run target/production/ghostty with `theme = Catppuccin Mocha` and
  `shell-integration = bash`: theme applied, titles show the cwd
This commit is contained in:
ddidderr committed 2026-10-12 21:11:39 +02:00
1 parent 908d5b105a
commit 733df84eaf
2 files changed
+15 -11

No files matched your search

+3 -3
View File
@@ -48,9 +48,9 @@ cargo run -- +list-themes # CLI actions work like Ghostty's
cargo run --profile production # optimized build (LTO, no debug assertions)
```
Dev-profile builds (`cargo run`) find `resources/` (shell integration,
themes, terminfo) automatically; other profiles use the installed
resources or `GHOSTTY_RESOURCES_DIR`. Your existing Ghostty config
Binaries run from this checkout's `target/` (any profile) find `resources/`
(shell integration, themes, terminfo) automatically; installed binaries use
the installed resources or `GHOSTTY_RESOURCES_DIR`. Your existing Ghostty config
(`~/.config/ghostty/config[.ghostty]`) is used as-is.
## Installing