This commit is contained in:
sxyazi 2023-08-28 13:59:58 +08:00
parent 0967a701f9
commit d7e2e1bc93
No known key found for this signature in database
2 changed files with 11 additions and 7 deletions

View file

@ -88,7 +88,7 @@ impl<'a> Widget for Folder<'a> {
}; };
let mut path = format!(" {icon} {}", readable_path(f.path(), &self.folder.cwd)); let mut path = format!(" {icon} {}", readable_path(f.path(), &self.folder.cwd));
if let Some(ref link_to) = f.link_to { if let Some(link_to) = f.link_to() {
if MANAGER.show_symlink { if MANAGER.show_symlink {
path.push_str(&format!(" -> {}", link_to.display())); path.push_str(&format!(" -> {}", link_to.display()));
} }

View file

@ -5,12 +5,12 @@ use tokio::fs;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct File { pub struct File {
pub(super) path: PathBuf, pub(super) path: PathBuf,
pub(super) meta: Metadata, pub(super) meta: Metadata,
pub(super) length: Option<u64>, pub(super) length: Option<u64>,
pub link_to: Option<PathBuf>, pub(super) link_to: Option<PathBuf>,
pub is_link: bool, pub(super) is_link: bool,
pub is_hidden: bool, pub(super) is_hidden: bool,
} }
impl File { impl File {
@ -59,4 +59,8 @@ impl File {
// --- Length // --- Length
#[inline] #[inline]
pub fn length(&self) -> Option<u64> { self.length } pub fn length(&self) -> Option<u64> { self.length }
// --- Link to
#[inline]
pub fn link_to(&self) -> Option<&PathBuf> { self.link_to.as_ref() }
} }