use std::path::Path;
pub fn scan_memory_dir(path: &Path) -> std::io::Result<Vec<String>> {
let mut memories = Vec::new();
if path.is_dir() {
for entry in std::fs::read_dir(path)? {
let entry = entry?;
let file_path = entry.path();
if file_path.is_file() {
if let Some(ext) = file_path.extension() {
if ext == "md" || ext == "markdown" {
memories.push(file_path.to_string_lossy().to_string());
}
}
}
}
}
Ok(memories)
}