Skip to content

fix: use runtime CARGO_MANIFEST_DIR#834

Merged
bunnie merged 1 commit intobetrusted-io:devfrom
sbellem:cargo-manifest-dir
Mar 18, 2026
Merged

fix: use runtime CARGO_MANIFEST_DIR#834
bunnie merged 1 commit intobetrusted-io:devfrom
sbellem:cargo-manifest-dir

Conversation

@sbellem
Copy link
Copy Markdown
Contributor

@sbellem sbellem commented Mar 18, 2026

Problem

project_root() in locales/build.rs and xtask/src/builder.rs uses the env!("CARGO_MANIFEST_DIR") macro, which captures the path at compile time. When the compiled binary runs in a different location than where it was originally built --- such as inside a Guix/Nix build sandbox or container -- the baked-in path is stale and points to the wrong directory.

Proposed Solution

Replace env!("CARGO_MANIFEST_DIR") with std::env::var("CARGO_MANIFEST_DIR"). This reads the variable at runtime, so it always reflects the actual workspace location.

Files changed:

  • locales/build.rs
  • xtask/src/builder.rs

Problem: env!() bakes the path at compile time,
so it breaks when the binary runs from a different
location (e.g. a Guix/Nix sandbox or container).

Solution: use std::env::var() to read it at runtime.
@bunnie bunnie merged commit e548696 into betrusted-io:dev Mar 18, 2026
9 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