repo: ignore non-".toml" files when reading recipes

This commit is contained in:
Sebastian Kuzminsky 2025-02-09 11:42:27 -07:00
parent 892bfa0d3b
commit 4bdb08f9a3

View file

@ -60,13 +60,18 @@ impl Repo {
// println!("trying {:?} ({:?})", dir_entry, file_type); // println!("trying {:?} ({:?})", dir_entry, file_type);
if file_type.is_file() { if file_type.is_file() {
let path = dir_entry.path(); let path = dir_entry.path();
match self.add_file(&path) { match path.extension() {
Ok(()) => { Some(s) if s.eq("toml") => {
// println!("added {:?}", dir_entry); match self.add_file(&path) {
} Ok(()) => {
Err(e) => { // println!("added {:?}", dir_entry);
println!("failed to read recipe from {:?}: {:?}", path, e); }
Err(e) => {
println!("failed to read recipe from {:?}: {:?}", path, e);
}
}
} }
_ => (), // skip unknown file extensions
} }
} else if file_type.is_dir() { } else if file_type.is_dir() {
let _ = self.add_dir(dir_entry.path().to_str().unwrap()); let _ = self.add_dir(dir_entry.path().to_str().unwrap());