/// Gets any DirEntry2 that isn't root.
///
/// Root doesn't have a DirEntry2.
///
/// When dynamic loading of files is supported, this is the required mechanism.
Gets any DirEntry2 that isn't root.
Root doesn't have a DirEntry2.

When dynamic loading of files is supported, this is the required mechanism.
Gets any DirEntry2 that isn ' t root . Root doesn ' t have a DirEntry2 . When dynamic loading of files is supported this is the required mechanism .
pub fn entry_at_path(&self, path: &Path) -> Result<Arc<DirEntry2>, ParsingError> {
        let root_inode = self.root_inode()?;
        let root_entries = self.entries_from_inode(&root_inode)?;
        let mut entry_map = DirEntry2::as_hash_map(root_entries)?;
        let mut components = path.components().peekable();
        let mut component = components.next();
        while component != None {
            match component {
                Some(Component::RootDir) => {
                    // Skip
                }
                Some(Component::Normal(name)) => {
                    let name = name.to_str().ok_or(ParsingError::InvalidInputPath)?;
                    if let Some(entry) = entry_map.remove(name) {
                        if components.peek() == None {
                            return Ok(entry);
                        }
                        match EntryType::from_u8(entry.e2d_type)? {
                            EntryType::Directory => {
                                let inode = self.inode(entry.e2d_ino.get())?;
                                entry_map =
                                    DirEntry2::as_hash_map(self.entries_from_inode(&inode)?)?;
                            }
                            _ => {
                                break;
                            }
                        }
                    }
                }
                _ => {
                    break;
                }
            }
            component = components.next();
        }
        match path.to_str() {
            Some(s) => Err(ParsingError::PathNotFound(s.to_string())),
            None => Err(ParsingError::PathNotFound(
                "Bad path - was not able to convert into string".to_string(),
            )),
        }
    }
pub fn entry_at_path ( & self , path : & Path ) -> Result < Arc < DirEntry2 > , ParsingError > { let root_inode = self . root_inode ( ) ? ; let root_entries = self . entries_from_inode ( & root_inode ) ? ; let mut entry_map = DirEntry2 :: as_hash_map ( root_entries ) ? ; let mut components = path . components ( ) . peekable ( ) ; let mut component = components . next ( ) ; while component != None { match component { Some ( Component :: RootDir ) => { // Skip } Some ( Component :: Normal ( name ) ) => { let name = name . to_str ( ) . ok_or ( ParsingError :: InvalidInputPath ) ? ; if let Some ( entry ) = entry_map . remove ( name ) { if components . peek ( ) == None { return Ok ( entry ) ; } match EntryType :: from_u8 ( entry . e2d_type ) ? { EntryType :: Directory => { let inode = self . inode ( entry . e2d_ino . get ( ) ) ? ; entry_map = DirEntry2 :: as_hash_map ( self . entries_from_inode ( & inode ) ? ) ? ; } _ => { break ; } } } } _ => { break ; } } component = components . next ( ) ; } match path . to_str ( ) { Some ( s ) => Err ( ParsingError :: PathNotFound ( s . to_string ( ) ) ) , None => Err ( ParsingError :: PathNotFound ( " " . to_string ( ) , ) ) , } }
Gets any DirEntry2 that isn't root.
Gets any DirEntry2 that isn ' t root .
&self
path
&Path