Skip to content

Commit

Permalink
Don't omit files when the creation date can't be obtained
Browse files Browse the repository at this point in the history
  • Loading branch information
grego committed May 23, 2021
1 parent be76f5b commit fa2006c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/sources.rs
Expand Up @@ -41,15 +41,20 @@ pub struct Sources {

impl Source {
#[inline]
fn new(path: PathBuf, src: Range<usize>, parent: usize, date: SystemTime) -> Result<Self> {
fn new(
path: PathBuf,
src: Range<usize>,
parent: usize,
date: Option<SystemTime>,
) -> Result<Self> {
Ok(Self {
source: src,
path: path_to_string(path)?.into(),
pages: 0..0,
subsections: 0..0,
is_section: false,
parent,
date: Some(date),
date,
to_load: None,
})
}
Expand Down Expand Up @@ -91,12 +96,9 @@ impl Sources {
})
.unwrap_or(false)
})
.filter_map(|entry| {
entry
.metadata()
.and_then(|m| m.created())
.map(|date| (entry.path(), date))
.ok()
.map(|entry| {
let date = entry.metadata().and_then(|m| m.created()).ok();
(entry.path(), date)
})
.filter(|(path, _)| {
path.file_stem()
Expand Down

0 comments on commit fa2006c

Please sign in to comment.