(dir: &PathBuf, out: &mut Vec<PathBuf>)
| 2 | use std::path::PathBuf; |
| 3 | |
| 4 | fn collect_protos(dir: &PathBuf, out: &mut Vec<PathBuf>) { |
| 5 | let mut entries: Vec<_> = std::fs::read_dir(dir) |
| 6 | .expect("proto dir readable") |
| 7 | .map(|e| e.expect("proto entry").path()) |
| 8 | .collect(); |
| 9 | entries.sort(); |
| 10 | for path in entries { |
| 11 | if path.is_dir() { |
| 12 | collect_protos(&path, out); |
| 13 | } else if path.extension().and_then(|e| e.to_str()) == Some("proto") { |
| 14 | out.push(path); |
| 15 | } |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 20 | #[cfg(feature = "node")] |