summaryrefslogtreecommitdiffstats
path: root/src/fs
diff options
context:
space:
mode:
authorKamiyaa <jeff.no.zhao@gmail.com>2020-06-06 15:00:15 -0400
committerKamiyaa <jeff.no.zhao@gmail.com>2020-06-06 15:00:15 -0400
commit4f3842b56f1729dcd8e81c77f98253ed9dfb23b3 (patch)
treea9cb1b5c300fcbdbcdfad34f0076919e30f03c88 /src/fs
parenta462ebe2140323a6085ce5a064727288fa4dff3c (diff)
shell command now parses correctly
- rework file operations - simpler model for listening on io_worker progress - cargo fmt/clippy
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/dirlist.rs15
-rw-r--r--src/fs/entry.rs2
2 files changed, 13 insertions, 4 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 {
diff --git a/src/fs/entry.rs b/src/fs/entry.rs
index fbcccb7..cae0f85 100644
--- a/src/fs/entry.rs
+++ b/src/fs/entry.rs
@@ -1,6 +1,6 @@
use std::{fs, path};
-use tui::style::{Color, Modifier, Style};
+use tui::style::{Modifier, Style};
use crate::fs::JoshutoMetadata;