/* * Copyright (C) 2024 Jonni Liljamo * * This file is licensed under GPL-3.0-or-later, see NOTICE and LICENSE for * more information. */ use std::{ fs::{self, DirEntry}, path::Path, }; pub fn collect_files(dir: &Path, files: &mut Vec) { for entry in fs::read_dir(dir).expect("could not read directory") { let entry = entry.expect("could not read directory entry"); let path = entry.path(); if path.is_dir() { collect_files(&path, files) } else if path.extension().unwrap() != "mkv" { panic!("file is not an mkv file: '{}'", path.to_string_lossy()) } else { files.push(entry); } } }