Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Resolve codegen root at runtime

Manav Rathi8622589bcc04
diff --git a/rust/apps/codegen/src/main.rs b/rust/apps/codegen/src/main.rs
index 8bd375da79..ce60556833 100644
--- a/rust/apps/codegen/src/main.rs
+++ b/rust/apps/codegen/src/main.rs
@@ -186,12 +186,11 @@ fn format_frb_bindings(target: FrbTarget) -> Result<(), DynError> {
}
fn rust_root() -> Result<PathBuf, DynError> {
- let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
- manifest_dir
- .parent()
- .and_then(Path::parent)
- .map(Path::to_path_buf)
- .ok_or_else(|| "failed to resolve rust workspace root".into())
+ let root = env::current_dir()?;
+ if !root.join("Cargo.toml").is_file() {
+ return Err("run cargo codegen from the Rust workspace root".into());
+ }
+ Ok(root)
}
fn target_dir() -> Result<PathBuf, DynError> {