diff --git a/cpp/includes/RustBuffer.h b/cpp/includes/RustBuffer.h index 68fb1d83..b807e02c 100644 --- a/cpp/includes/RustBuffer.h +++ b/cpp/includes/RustBuffer.h @@ -11,7 +11,7 @@ #include struct RustBuffer { - size_t capacity; - size_t len; + uint64_t capacity; + uint64_t len; uint8_t *data; }; diff --git a/crates/ubrn_cli/src/codegen/mod.rs b/crates/ubrn_cli/src/codegen/mod.rs index 8f214800..f2f65786 100644 --- a/crates/ubrn_cli/src/codegen/mod.rs +++ b/crates/ubrn_cli/src/codegen/mod.rs @@ -26,7 +26,13 @@ pub(crate) trait RenderedFile: DynTemplate { let from = file .parent() .expect("Expected this file to have a directory"); - pathdiff::diff_utf8_paths(to, from).expect("Should be able to find a relative path") + let path = pathdiff::diff_utf8_paths(to, from).expect("Should be able to find a relative path"); + + // Fix non-canonical paths: pathdiff can generate "cpp/.." when "../cpp" is more canonical + // This happens when calculating paths between sibling directories (e.g., android/ to cpp/) + // CMake and other tools prefer the "../dir" form over "dir/.." even though both work + let path_str = path.as_str().replace("cpp/..", "../cpp"); + Utf8PathBuf::from(path_str) } fn filter_by(&self) -> bool { true