summaryrefslogtreecommitdiffstats
path: root/src/fs/dirlist.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/dirlist.rs')
-rw-r--r--src/fs/dirlist.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/fs/dirlist.rs b/src/fs/dirlist.rs
index 4bda62c..df42b9a 100644
--- a/src/fs/dirlist.rs
+++ b/src/fs/dirlist.rs
@@ -8,7 +8,6 @@ pub struct JoshutoDirList {
pub index: Option<usize>,
path: path::PathBuf,
content_outdated: bool,
- order_outdated: bool,
pub metadata: JoshutoMetadata,
pub contents: Vec<JoshutoDirEntry>,
}
@@ -27,18 +26,28 @@ impl JoshutoDirList {
index,
path,
content_outdated: false,
- order_outdated: false,
metadata,
contents,
})
}
+ pub fn modified(&self) -> bool {
+ let metadata = std::fs::symlink_metadata(self.path.as_path());
+ match metadata {
+ Ok(m) => match m.modified() {
+ Ok(s) => s > self.metadata.modified,
+ _ => false,
+ },
+ _ => false,
+ }
+ }
+
pub fn depreciate(&mut self) {
self.content_outdated = true;
}
pub fn need_update(&self) -> bool {
- self.content_outdated
+ self.content_outdated || self.modified()
}
pub fn file_path(&self) -> &path::PathBuf {