mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
Fix revalidation
This commit is contained in:
parent
aba0b5ad01
commit
34393c29ea
1 changed files with 3 additions and 15 deletions
|
|
@ -112,22 +112,10 @@ pub trait Engine: Sized {
|
|||
|
||||
fn read_link(&self) -> impl Future<Output = io::Result<PathBufDyn>>;
|
||||
|
||||
fn revalidate(&self, mut file: File) -> impl Future<Output = io::Result<Option<File>>> {
|
||||
fn revalidate(&self, file: File) -> impl Future<Output = io::Result<Option<File>>> {
|
||||
async move {
|
||||
let cha = if !file.is_link() {
|
||||
self.symlink_metadata().await?
|
||||
} else if let Ok(new) = self.metadata().await {
|
||||
file.cha.follow(Some(new))
|
||||
} else {
|
||||
self.symlink_metadata().await?
|
||||
};
|
||||
|
||||
if cha.hits(file.cha) {
|
||||
Ok(None)
|
||||
} else {
|
||||
file.cha = cha;
|
||||
Ok(Some(file))
|
||||
}
|
||||
let new = self.file().await?;
|
||||
if new.cha.hits(file.cha) { Ok(None) } else { Ok(Some(new)) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue