Using multi-level deep folders successfully but the output is still shallow.
This commit is contained in:
parent
b9f74b7eca
commit
c5621212bc
@ -86,24 +86,19 @@ async fn filter_to_highest_folders_containing_org_files(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn get_post_directories(config: &Config) -> Result<Vec<PathBuf>, CustomError> {
|
async fn get_post_directories(config: &Config) -> Result<Vec<PathBuf>, CustomError> {
|
||||||
|
if !config.get_posts_directory().exists() {
|
||||||
|
return Ok(Vec::new());
|
||||||
|
}
|
||||||
|
|
||||||
let top_level_org_folders = walk_fs(
|
let top_level_org_folders = walk_fs(
|
||||||
config.get_posts_directory(),
|
config.get_posts_directory(),
|
||||||
filter_to_highest_folders_containing_org_files,
|
filter_to_highest_folders_containing_org_files,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
Ok(top_level_org_folders
|
||||||
let mut ret = Vec::new();
|
.into_iter()
|
||||||
if !config.get_posts_directory().exists() {
|
.map(|entry| entry.path())
|
||||||
return Ok(ret);
|
.collect())
|
||||||
}
|
|
||||||
let mut entries = tokio::fs::read_dir(config.get_posts_directory()).await?;
|
|
||||||
while let Some(entry) = entries.next_entry().await? {
|
|
||||||
let file_type = entry.file_type().await?;
|
|
||||||
if file_type.is_dir() {
|
|
||||||
ret.push(entry.path());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(ret)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn load_blog_posts(config: &Config) -> Result<Vec<BlogPost>, CustomError> {
|
async fn load_blog_posts(config: &Config) -> Result<Vec<BlogPost>, CustomError> {
|
||||||
|
Loading…
Reference in New Issue
Block a user