Refactor get_dynamic_search_path

Will need it in a follow-up PR
This commit is contained in:
Vitali Lovich 2025-03-04 05:51:53 -08:00
parent 29f8d039bb
commit c1f7bb9285

View File

@ -659,6 +659,13 @@ fn add_plugin_deps(
Ok(())
}
fn get_dynamic_search_path(path: &Path) -> &Path {
match path.to_str().and_then(|s| s.split_once("=")) {
Some(("native" | "crate" | "dependency" | "framework" | "all", path)) => Path::new(path),
_ => path,
}
}
// Determine paths to add to the dynamic search path from -L entries
//
// Strip off prefixes like "native=" or "framework=" and filter out directories
@ -670,12 +677,9 @@ where
{
let mut search_path = vec![];
for dir in paths {
let dir = match dir.to_str().and_then(|s| s.split_once("=")) {
Some(("native" | "crate" | "dependency" | "framework" | "all", path)) => path.into(),
_ => dir.clone(),
};
let dir = get_dynamic_search_path(dir);
if dir.starts_with(&root_output) {
search_path.push(dir);
search_path.push(dir.to_path_buf());
} else {
debug!(
"Not including path {} in runtime library search path because it is \