summaryrefslogtreecommitdiff
path: root/src/bin/subplot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/subplot.rs')
-rw-r--r--src/bin/subplot.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bin/subplot.rs b/src/bin/subplot.rs
index 907e616..8ede58d 100644
--- a/src/bin/subplot.rs
+++ b/src/bin/subplot.rs
@@ -278,7 +278,8 @@ impl Docgen {
} else if let Some(date) = doc.meta().date() {
date.to_string()
} else {
- Self::mtime_formatted(Self::mtime(doc.meta().markdown_filename())?)
+ let filename = doc.meta().basedir().join(doc.meta().markdown_filename());
+ Self::mtime_formatted(Self::mtime(&filename)?)
};
pandoc.add_option(pandoc::PandocOption::Meta("date".to_string(), Some(date)));
pandoc.add_option(pandoc::PandocOption::TableOfContents);
@@ -308,7 +309,10 @@ impl Docgen {
}
fn mtime(filename: &Path) -> Result<(u64, u32)> {
- let mtime = fs::metadata(filename)?.modified()?;
+ let mtime = fs::metadata(filename)
+ .map_err(|e| SubplotError::InputFileUnreadable(filename.into(), e))?
+ .modified()
+ .map_err(|e| SubplotError::InputFileMtime(filename.into(), e))?;
let mtime = mtime.duration_since(UNIX_EPOCH)?;
Ok((mtime.as_secs(), mtime.subsec_nanos()))
}