1use std::{
2 io,
3 path::{Path, PathBuf},
4};
5pub mod deserializer;
6pub mod header;
7pub mod meta;
8pub mod option;
9pub mod serializer;
10pub mod version;
11
12pub const BUFFER_LENGTH: usize = 8192;
13
14fn get_file_list<O: AsRef<Path>>(root: O) -> io::Result<Vec<PathBuf>> {
17 let mut image_list: Vec<PathBuf> = Vec::new();
18 let mut file_list: Vec<PathBuf> = root
19 .as_ref()
20 .read_dir()?
21 .map(|entry| entry.unwrap().path())
22 .collect();
23 let mut i = 0;
24 loop {
25 if i >= file_list.len() {
26 break;
27 }
28 if file_list[i].is_dir() {
29 for component in file_list[i].read_dir()? {
30 file_list.push(component.unwrap().path());
31 }
32 } else if file_list[i]
33 .file_name()
34 .unwrap()
35 .to_str()
36 .unwrap()
37 .chars()
38 .collect::<Vec<_>>()[0]
39 != '.'
40 {
41 image_list.push(file_list[i].to_path_buf());
42 }
43 i += 1;
44 }
45
46 Ok(image_list)
47}