use std::fs;
use std::io;
use std::path::PathBuf;
pub(crate) fn find_svg_files(vec_to_append: &mut Vec<PathBuf>, path: &PathBuf, recursive: bool) -> io::Result<()> {
if path.is_file() {
if path.extension().and_then(|e| e.to_str()) == Some("svg") {
vec_to_append.push(path.clone());
}
return Ok(());
}
for entry in fs::read_dir(path)? {
let entry = entry?;
let path = entry.path();
if path.is_dir() && recursive {
find_svg_files(vec_to_append, &path, recursive)?;
} else if path.extension().and_then(|e| e.to_str()) == Some("svg") {
vec_to_append.push(path.clone());
}
}
Ok(())
}