Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty CARGO_MANIFEST_DIR env when running with dx #3792

Open
photino opened this issue Feb 24, 2025 · 1 comment
Open

Empty CARGO_MANIFEST_DIR env when running with dx #3792

photino opened this issue Feb 24, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@photino
Copy link
Contributor

photino commented Feb 24, 2025

Problem

Steps To Reproduce

Steps to reproduce the behavior:

  • Gets the CARGO_MANIFEST_DIR
  • When running the code with dx, it prints empty string.
if let Ok(s) = std::env::var("CARGO_MANIFEST_DIR") {
    tracing::info!("CARGO_MANIFEST_DIR: {}", s);
} else {
    tracing::info!("No CARGO_MANIFEST_DIR");
}

Expected behavior

The env should not be empty.

Screenshots

Environment:

  • Dioxus version: 0.6.3
  • Rust version: 1.85
  • OS info: Windows
  • App platform: Desktop

Questionnaire

I'm interested in fixing this myself but don't know where to start.

@photino photino added the bug Something isn't working label Feb 24, 2025
@photino
Copy link
Contributor Author

photino commented Feb 24, 2025

From Environment variables Cargo sets for crates, it says

Note that if one of these values is not provided in the manifest, the corresponding environment variable is set to the empty string, "".

It means that dx serve does not run with cargo. How can we get the dir like CARGO_MANIFEST_DIR?

Perhaps we need a DIOXUS_MANIFEST_DIR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant