fn parse_ld_paths(&self, ld_path: &str, elf_path: &Path) -> Result<Vec<String>, Error> {
        let mut paths = Vec::new();
        for path in ld_path.split(':') {
            let normpath = if path.is_empty() {
                // The ldso treats empty paths as the current directory
                env::current_dir()
            } else if path.contains("$ORIGIN") || path.contains("${ORIGIN}") {
                let elf_path = elf_path.canonicalize()?;
                let elf_dir = elf_path.parent().expect("no parent");
                let replacement = elf_dir.to_str().unwrap();
                let path = path
                    .replace("${ORIGIN}", replacement)
                    .replace("$ORIGIN", replacement);
                PathBuf::from(path).canonicalize()
            } else {
                self.root
                    .join(path.strip_prefix('/').unwrap_or(path))
                    .canonicalize()
            };
            if let Ok(normpath) = normpath {
                paths.push(normpath.display().to_string());
            }
        }
        Ok(paths)
    }
/// Parse the colon-delimited list of paths and apply ldso rules
Parse the colon-delimited list of paths and apply ldso rules
Parse the colon - delimited list of paths and apply ldso rules
fn parse_ld_paths(&self, ld_path: &str, elf_path: &Path) -> Result<Vec<String>, Error> {
        let mut paths = Vec::new();
        for path in ld_path.split(':') {
            let normpath = if path.is_empty() {
                // The ldso treats empty paths as the current directory
                env::current_dir()
            } else if path.contains("$ORIGIN") || path.contains("${ORIGIN}") {
                let elf_path = elf_path.canonicalize()?;
                let elf_dir = elf_path.parent().expect("no parent");
                let replacement = elf_dir.to_str().unwrap();
                let path = path
                    .replace("${ORIGIN}", replacement)
                    .replace("$ORIGIN", replacement);
                PathBuf::from(path).canonicalize()
            } else {
                self.root
                    .join(path.strip_prefix('/').unwrap_or(path))
                    .canonicalize()
            };
            if let Ok(normpath) = normpath {
                paths.push(normpath.display().to_string());
            }
        }
        Ok(paths)
    }
fn parse_ld_paths ( & self , ld_path : & str , elf_path : & Path ) -> Result < Vec < String > , Error > { let mut paths = Vec :: new ( ) ; for path in ld_path . split ( ':' ) { let normpath = if path . is_empty ( ) { // The ldso treats empty paths as the current directory env :: current_dir ( ) } else if path . contains ( " " ) || path . contains ( " " ) { let elf_path = elf_path . canonicalize ( ) ? ; let elf_dir = elf_path . parent ( ) . expect ( " " ) ; let replacement = elf_dir . to_str ( ) . unwrap ( ) ; let path = path . replace ( " " , replacement ) . replace ( " " , replacement ) ; PathBuf :: from ( path ) . canonicalize ( ) } else { self . root . join ( path . strip_prefix ( '/' ) . unwrap_or ( path ) ) . canonicalize ( ) } ; if let Ok ( normpath ) = normpath { paths . push ( normpath . display ( ) . to_string ( ) ) ; } } Ok ( paths ) }
Parse the colon-delimited list of paths and apply ldso rules
Parse the colon - delimited list of paths and apply ldso rules
&self
ld_path
&str
elf_path
&Path
&self
ld_path
&str
elf_path
&Path