Compute the path to the built cdylib. Checks debug, release, and ci profile dirs.
(target_path: &Path)
| 23 | |
| 24 | /// Compute the path to the built cdylib. Checks debug, release, and ci profile dirs. |
| 25 | fn compute_library_dir(target_path: &Path) -> PathBuf { |
| 26 | let debug_dir = target_path.join("debug"); |
| 27 | let release_dir = target_path.join("release"); |
| 28 | let ci_dir = target_path.join("ci"); |
| 29 | |
| 30 | let all_dirs = vec![debug_dir.clone(), release_dir, ci_dir]; |
| 31 | |
| 32 | all_dirs |
| 33 | .into_iter() |
| 34 | .filter(|dir| dir.join("deps").exists()) |
| 35 | .filter_map(|dir| { |
| 36 | dir.join("deps") |
| 37 | .metadata() |
| 38 | .and_then(|m| m.modified()) |
| 39 | .ok() |
| 40 | .map(|date| (dir, date)) |
| 41 | }) |
| 42 | .max_by_key(|(_, date)| *date) |
| 43 | .map(|(dir, _)| dir) |
| 44 | .unwrap_or(debug_dir) |
| 45 | } |
| 46 | |
| 47 | /// Find the cdylib file for datafusion_ffi in the given directory. |
| 48 | fn find_cdylib(deps_dir: &Path) -> Result<PathBuf> { |