/// Build node tree by loading bootstrap file
Build node tree by loading bootstrap file
Build node tree by loading bootstrap file
fn load_children(&self, ino: Inode, parent: Option<&PathBuf>) -> Result<Vec<Tree>> {
        let inode = self.rs.get_inode(ino, true)?;
        let child_index = inode.get_child_index()?;
        let child_count = inode.get_child_count();
        let parent_path = if let Some(parent) = parent {
            parent.join(inode.name()?)
        } else {
            PathBuf::from_str("/").unwrap()
        };
        let mut children = Vec::new();
        if inode.is_dir() {
            for idx in child_index..(child_index + child_count) {
                let child = self.rs.get_inode(idx as Inode, true)?;
                let child_path = parent_path.join(child.name()?);
                let child = self.parse_node(child, child_path.clone())?;
                let mut child = Tree::new(child);
                child.children = self.load_children(idx as Inode, Some(&parent_path))?;
                children.push(child);
            }
        }
        Ok(children)
    }
fn load_children ( & self , ino : Inode , parent : Option < & PathBuf > ) -> Result < Vec < Tree > > { let inode = self . rs . get_inode ( ino , true ) ? ; let child_index = inode . get_child_index ( ) ? ; let child_count = inode . get_child_count ( ) ; let parent_path = if let Some ( parent ) = parent { parent . join ( inode . name ( ) ? ) } else { PathBuf :: from_str ( " " ) . unwrap ( ) } ; let mut children = Vec :: new ( ) ; if inode . is_dir ( ) { for idx in child_index .. ( child_index + child_count ) { let child = self . rs . get_inode ( idx as Inode , true ) ? ; let child_path = parent_path . join ( child . name ( ) ? ) ; let child = self . parse_node ( child , child_path . clone ( ) ) ? ; let mut child = Tree :: new ( child ) ; child . children = self . load_children ( idx as Inode , Some ( & parent_path ) ) ? ; children . push ( child ) ; } } Ok ( children ) }
Build node tree by loading bootstrap file
Build node tree by loading bootstrap file
&self
ino
Inode
parent
Option<&PathBuf>