summaryrefslogtreecommitdiffstats
path: root/src/meta/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/meta/mod.rs')
-rw-r--r--src/meta/mod.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/meta/mod.rs b/src/meta/mod.rs
index 4f51191..b29a57a 100644
--- a/src/meta/mod.rs
+++ b/src/meta/mod.rs
@@ -1,6 +1,7 @@
mod date;
mod filetype;
mod indicator;
+mod inode;
mod name;
mod owner;
mod permissions;
@@ -13,6 +14,7 @@ mod windows_utils;
pub use self::date::Date;
pub use self::filetype::FileType;
pub use self::indicator::Indicator;
+pub use self::inode::INode;
pub use self::name::Name;
pub use self::owner::Owner;
pub use self::permissions::Permissions;
@@ -20,6 +22,7 @@ pub use self::size::Size;
pub use self::symlink::SymLink;
pub use crate::flags::Display;
pub use crate::icon::Icons;
+use crate::print_error;
use std::fs;
use std::fs::read_link;
@@ -39,6 +42,7 @@ pub struct Meta {
pub size: Size,
pub symlink: SymLink,
pub indicator: Indicator,
+ pub inode: INode,
pub content: Option<Vec<Meta>>,
}
@@ -65,7 +69,7 @@ impl Meta {
let entries = match self.path.read_dir() {
Ok(entries) => entries,
Err(err) => {
- eprintln!("cannot access '{}': {}", self.path.display(), err);
+ print_error!("lsd: {}: {}\n", self.path.display(), err);
return Ok(None);
}
};
@@ -112,7 +116,7 @@ impl Meta {
let mut entry_meta = match Self::from_path(&path) {
Ok(res) => res,
Err(err) => {
- eprintln!("cannot access '{}': {}", path.display(), err);
+ print_error!("lsd: {}: {}\n", path.display(), err);
continue;
}
};
@@ -120,7 +124,7 @@ impl Meta {
match entry_meta.recurse_into(depth - 1, display, ignore_globs) {
Ok(content) => entry_meta.content = content,
Err(err) => {
- eprintln!("cannot access '{}': {}", path.display(), err);
+ print_error!("lsd: {}: {}\n", path.display(), err);
continue;
}
};
@@ -158,7 +162,7 @@ impl Meta {
let metadata = match metadata {
Ok(meta) => meta,
Err(err) => {
- eprintln!("cannot access '{}': {}", path.display(), err);
+ print_error!("lsd: {}: {}\n", path.display(), err);
return 0;
}
};
@@ -171,7 +175,7 @@ impl Meta {
let entries = match path.read_dir() {
Ok(entries) => entries,
Err(err) => {
- eprintln!("cannot access '{}': {}", path.display(), err);
+ print_error!("lsd: {}: {}\n", path.display(), err);
return size;
}
};
@@ -179,7 +183,7 @@ impl Meta {
let path = match entry {
Ok(entry) => entry.path(),
Err(err) => {
- eprintln!("cannot access '{}': {}", path.display(), err);
+ print_error!("lsd: {}: {}\n", path.display(), err);
continue;
}
};
@@ -210,8 +214,10 @@ impl Meta {
let file_type = FileType::new(&metadata, &permissions);
let name = Name::new(&path, file_type);
+ let inode = INode::from(&metadata);
Ok(Self {
+ inode,
path: path.to_path_buf(),
symlink: SymLink::from(path.as_path()),
size: Size::from(&metadata),