12 lines
272 B
Rust
12 lines
272 B
Rust
|
|
use std::fs;
|
||
|
|
use std::path::{Path, PathBuf};
|
||
|
|
|
||
|
|
pub fn list_files(dir: &str) -> Vec<PathBuf> {
|
||
|
|
fs::read_dir(dir)
|
||
|
|
.expect("Failed to read directory")
|
||
|
|
.filter_map(|e| e.ok())
|
||
|
|
.map(|e| e.path())
|
||
|
|
.filter(|p| p.is_file())
|
||
|
|
.collect()
|
||
|
|
}
|