summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b0cadeb..3535952 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -25,29 +25,10 @@ impl fmt::Display for WalkResult {
}
}
-pub fn file_size_no_symlink_follow(meta: &fs::Metadata) -> u64 {
- match meta.file_type().is_symlink() {
- // true => sys::symlink_size(meta),
- true => unimplemented!("{} {}", sys::symlink_size(meta), meta.len()),
- false => meta.len(),
- }
-}
-
-#[cfg(target_os = "macos")]
-mod sys {
- use std::fs::Metadata;
- use std::os::macos::fs::MetadataExt;
-
- pub fn symlink_size(meta: &Metadata) -> u64 {
- meta.st_size()
- }
-}
-
mod aggregate {
- use crate::{file_size_no_symlink_follow, WalkOptions, WalkResult};
+ use crate::{WalkOptions, WalkResult};
use failure::Error;
- use std::io;
- use std::path::Path;
+ use std::{io, path::Path};
pub fn aggregate(
mut out: impl io::Write,
@@ -61,7 +42,7 @@ mod aggregate {
match entry {
Ok(entry) => {
num_bytes += match entry.metadata {
- Some(Ok(m)) => file_size_no_symlink_follow(&m),
+ Some(Ok(m)) => m.len(),
Some(Err(_)) => {
res.num_errors += 1;
0
@@ -83,5 +64,4 @@ mod aggregate {
pub use aggregate::aggregate;
use jwalk::WalkDir;
-use std::path::Path;
-use std::{fmt, fs};
+use std::{fmt, path::Path};