Implemented the get_dir_files function
parent
d4a6c1132d
commit
4561caa6cf
|
@ -14,7 +14,27 @@ pub fn validate(verbosity: u8, config: util::config::Config) {
|
|||
// 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 {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue