Write the filter to find the highest folders containing org documents.
This commit is contained in:
		
							parent
							
								
									493adb4688
								
							
						
					
					
						commit
						b9f74b7eca
					
				| @ -66,13 +66,27 @@ async fn filter_to_highest_folders_containing_org_files( | ||||
|     entry: &DirEntry, | ||||
| ) -> Result<WalkAction, CustomError> { | ||||
|     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<Vec<PathBuf>, CustomError> { | ||||
|     walk_fs( | ||||
|     let top_level_org_folders = walk_fs( | ||||
|         config.get_posts_directory(), | ||||
|         filter_to_highest_folders_containing_org_files, | ||||
|     ) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander