don't crash if blog folder doesnt exist
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending
This commit is contained in:
parent
4984e3673e
commit
fd228be916
1 changed files with 7 additions and 5 deletions
|
@ -52,11 +52,13 @@ struct Post {
|
|||
}
|
||||
|
||||
fn get_posts(location: &str) -> Vec<Post> {
|
||||
let entries = std::fs::read_dir(location)
|
||||
.unwrap()
|
||||
.flatten()
|
||||
.filter(|f| f.path().extension().unwrap() == "md")
|
||||
.collect::<Vec<std::fs::DirEntry>>();
|
||||
let entries = match std::fs::read_dir(location) {
|
||||
Ok(res) => res
|
||||
.flatten()
|
||||
.filter(|f| f.path().extension().unwrap() == "md")
|
||||
.collect::<Vec<std::fs::DirEntry>>(),
|
||||
Err(_) => vec![],
|
||||
};
|
||||
|
||||
entries
|
||||
.iter()
|
||||
|
|
Loading…
Reference in a new issue