feat-deviant(os): embed a configurable resource directory
Relocating a Cargo-installed binary loses executable-relative resource lookup even when themes and shell integration exist under /usr/share. Allow packagers to set GHOSTTY_BUILD_RESOURCES_DIR when compiling. Absolute paths are used directly; relative paths resolve against the running executable's directory for relocatable installations. Explicit paths do not require terminfo sentinels. A nonempty runtime override wins in every profile when the build option is configured. Unset or empty build options preserve existing discovery, including debug precedence. Cargo watches the build option so changing or unsetting it recompiles lookup. Resource files still need to be installed separately. Document this requested upstream deviation and the build option in the README, architecture overview, and deviation register. Test Plan: - Eight resource lookup unit tests pass. - Nightly formatting and ghostty-os Clippy with -D warnings pass. - Production build with /usr/share/ghostty succeeds; a copied executable lists all 463 themes with no runtime override. - Compiled probes verify absolute, relative, unset, and empty options, Cargo rebuilds, relocation, runtime overrides, and unrelated cwd. Deviation-Register: docs/rewrite/DEVIANT_FIXES.md
This commit is contained in:
1 parent
4cfeee71cc
commit
85489a164e
5 files changed
+142
-15
No files matched your search
@@ -5,6 +5,8 @@
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-env-changed=PROFILE");
|
||||
// Recompile resource lookup when the packager changes the embedded path.
|
||||
println!("cargo:rerun-if-env-changed=GHOSTTY_BUILD_RESOURCES_DIR");
|
||||
println!("cargo:rustc-check-cfg=cfg(ghostty_debug_build)");
|
||||
if std::env::var("PROFILE").is_ok_and(|p| p == "debug") {
|
||||
println!("cargo:rustc-cfg=ghostty_debug_build");
|
||||
|
||||
Reference in new issue
Block a user