mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-08-24 07:12:04 +10:00
feat: Migrate all features to droplet-rs
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
use std::{
|
||||
fs::{self, metadata},
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
fn list_files_recursive(vec: &mut Vec<PathBuf>, path: &Path) {
|
||||
if metadata(path).unwrap().is_dir() {
|
||||
let paths = fs::read_dir(path).unwrap();
|
||||
for path_result in paths {
|
||||
let full_path = path_result.unwrap().path();
|
||||
if metadata(&full_path).unwrap().is_dir() {
|
||||
list_files_recursive(vec, &full_path);
|
||||
} else {
|
||||
vec.push(full_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn list_files(path: &Path) -> Vec<PathBuf> {
|
||||
let mut vec = Vec::new();
|
||||
list_files_recursive(&mut vec, path);
|
||||
vec
|
||||
}
|
||||
Reference in New Issue
Block a user