diff --git a/src/directory.rs b/src/directory.rs
index 6bfdfdc..fefcb63 100644
--- a/src/directory.rs
+++ b/src/directory.rs
@@ -1,8 +1,10 @@
+use std::ffi::OsString;
use std::fs::read_dir;
-use std::hint::unreachable_unchecked;
use std::path::{Path, PathBuf};
-use std::io::{Result, ErrorKind};
+use std::io::ErrorKind;
+use anyhow::{Context, Result};
+use crate::args::Args;
use crate::unit::Unit;
use rayon::prelude::*;
@@ -19,38 +21,55 @@ impl Directory {
self.size
}
- #[inline]
- pub fn scale(&self, unit: Unit) -> String {
- unit.convert(self.size)
- }
-
#[inline]
pub fn path(&self) -> &Path {
self.name.as_ref()
}
- pub fn new
(path: P) -> Result
- where
- P: AsRef
- {
+ pub fn new< P: AsRef >(path: P, args: &Args) -> Result