Implemented the get_dir_files function

pull/5/head
Ayrton Chilibeck 2024-01-12 22:57:11 -07:00
parent d4a6c1132d
commit 4561caa6cf
Signed by: ayrton
GPG Key ID: BAE24A03DCBF160D
1 changed files with 21 additions and 1 deletions

View File

@ -14,7 +14,27 @@ pub fn validate(verbosity: u8, config: util::config::Config) {
// make sure each has a match // make sure each has a match
} }
fn get_dir_files(path: PathBuf) -> Result<Vec<PathBuf>, &'static str> {} fn get_dir_files(path: PathBuf) -> Result<Vec<PathBuf>, &'static str> {
let mut res: Vec<PathBuf>;
// get the readout of the path for error handling
let entries = match fs::read_dir(path) {
Ok(x) => x,
Err(error) => return Err("Failed to read from the given directory"),
};
for entry in entries {
let p = entry.expect("Bad element: validate::get_dir_files(..)");
if p.path().is_dir() {
();
} else {
res.push(p.path());
}
}
return Ok(res);
}
fn check_suffix(path: PathBuf, suf: String) -> bool { fn check_suffix(path: PathBuf, suf: String) -> bool {
return return