pub fn read_dir(&mut self, dir: PathBuf) {
        if !dir.exists() || !dir.is_dir() {
            return;
        }
        let mut stack: Vec<PathBuf> = vec![];
        stack.push(PathBuf::from(&dir));
        while let Some(d) = stack.pop() {
            if let Ok(iter) = d.read_dir() {
                iter.for_each(|entry| {
                    if let Ok(item) = entry {
                        if !item.file_name().to_string_lossy().starts_with(".") {
                            let p: PathBuf = item.path();
                            if p.is_dir() {
                                stack.push(p);
                            } else {
                                self.add_relative(p, &dir);
                            }
                        }
                    }
                })
            }
        }
    }
// Read and add files from a directory
Read and add files from a directory
Read and add files from a directory
pub fn read_dir(&mut self, dir: PathBuf) {
        if !dir.exists() || !dir.is_dir() {
            return;
        }
        let mut stack: Vec<PathBuf> = vec![];
        stack.push(PathBuf::from(&dir));
        while let Some(d) = stack.pop() {
            if let Ok(iter) = d.read_dir() {
                iter.for_each(|entry| {
                    if let Ok(item) = entry {
                        if !item.file_name().to_string_lossy().starts_with(".") {
                            let p: PathBuf = item.path();
                            if p.is_dir() {
                                stack.push(p);
                            } else {
                                self.add_relative(p, &dir);
                            }
                        }
                    }
                })
            }
        }
    }
pub fn read_dir ( & mut self , dir : PathBuf ) { if ! dir . exists ( ) || ! dir . is_dir ( ) { return ; } let mut stack : Vec < PathBuf > = vec ! [ ] ; stack . push ( PathBuf :: from ( & dir ) ) ; while let Some ( d ) = stack . pop ( ) { if let Ok ( iter ) = d . read_dir ( ) { iter . for_each ( | entry | { if let Ok ( item ) = entry { if ! item . file_name ( ) . to_string_lossy ( ) . starts_with ( " " ) { let p : PathBuf = item . path ( ) ; if p . is_dir ( ) { stack . push ( p ) ; } else { self . add_relative ( p , & dir ) ; } } } } ) } } }
Read and add files from a directory
Read and add files from a directory
&mut self
dir
PathBuf
&mut self
dir
PathBuf