PengZheng commented on code in PR #627:
URL: https://github.com/apache/celix/pull/627#discussion_r1328043877


##########
misc/experimental/rust/celix_bindings/build.rs:
##########
@@ -17,23 +17,37 @@
  * under the License.
  */
 
-extern crate bindgen;
-
+use std::env;
 use std::error::Error;
-use std::path::PathBuf;
 use std::fs::File;
 use std::io::{self, BufRead};
-use std::env;
+use std::path::PathBuf;
 
-fn print_include_paths() -> Result<Vec<String>, Box<dyn Error>> {
-    let build_dir = PathBuf::from(env::var("CORROSION_BUILD_DIR").unwrap());
-    let include_path_file = build_dir.join("include_paths.txt");
+fn open_include_paths_file() -> Result<File, Box<dyn Error>> {
+    let file: File;
 
-    //let include_path_file = Path::new("include_paths.txt");
-    let file = File::open(&include_path_file)?;
+    let corrosion_build_dir = env::var("CORROSION_BUILD_DIR");
+    if corrosion_build_dir.is_ok() {
+        let build_dir = PathBuf::from(corrosion_build_dir.unwrap());
+        let include_path_file = build_dir.join("include_paths.txt");
+        file = File::open(&include_path_file)?;
+    } else {
+        println!("include_paths.txt not found in CORROSION_BUILD_DIR. Failing 
back to CELIX_RUST_INCLUDE_PATHS_FILE env value");

Review Comment:
   If the message expresses the real intention, then the currently 
implementation, which fails back to `CELIX_RUST_INCLUDE_PATHS_FILE` if 
`CORROSION_BUILD_DIR` is not **set**, is wrong.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to