summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-06-03 06:47:59 +0300
committerLars Wirzenius <liw@liw.fi>2023-06-03 18:13:06 +0300
commite8dca81ac5fca1cd7bd3532293858e52eb376882 (patch)
tree7a9bde8b2b7b35c8ed992ed8da32d705c6fe55d7 /src
parentb3f9948a720eae708f7575d9a05943b85f328e42 (diff)
downloadsubplot-e8dca81ac5fca1cd7bd3532293858e52eb376882.tar.gz
fix: allow docgen to handle a subplot not in current directory
Sponsored-by: author
Diffstat (limited to 'src')
-rw-r--r--src/bin/subplot.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bin/subplot.rs b/src/bin/subplot.rs
index b95b550..b23f858 100644
--- a/src/bin/subplot.rs
+++ b/src/bin/subplot.rs
@@ -265,8 +265,14 @@ impl Docgen {
date.to_string()
} else {
let mut newest = None;
+ let basedir = if let Some(basedir) = self.input.parent() {
+ basedir.to_path_buf()
+ } else {
+ return Err(SubplotError::BasedirError(self.input.clone()).into());
+ };
for filename in doc.meta().markdown_filenames() {
- let mtime = Self::mtime(filename)?;
+ let filename = basedir.join(filename);
+ let mtime = Self::mtime(&filename)?;
if let Some(so_far) = newest {
if mtime > so_far {
newest = Some(mtime);