diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index b9fe1b7..9b9b8c3 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -66,13 +66,27 @@ async fn filter_to_highest_folders_containing_org_files( entry: &DirEntry, ) -> Result { let file_type = entry.file_type().await?; + if !file_type.is_dir() { + return Ok(WalkAction::Halt); + } let mut entries = tokio::fs::read_dir(entry.path()).await?; - - todo!() + while let Some(entry) = entries.next_entry().await? { + let entry_type = entry.file_type().await?; + if !entry_type.is_file() { + continue; + } + match entry.path().extension().and_then(OsStr::to_str) { + Some("org") => { + return Ok(WalkAction::HaltAndCapture); + } + _ => {} + } + } + Ok(WalkAction::Recurse) } async fn get_post_directories(config: &Config) -> Result, CustomError> { - walk_fs( + let top_level_org_folders = walk_fs( config.get_posts_directory(), filter_to_highest_folders_containing_org_files, )