This commit is contained in:
ascendforever 2023-10-24 22:55:01 -04:00
parent 3a08575063
commit 12efedb205

View file

@ -253,16 +253,12 @@ fn register(path: PathBuf, registry: &mut HashMap<u64, Vec<PathBuf>>, cfg: &Conf
if metadata.file_type().is_symlink() { if metadata.file_type().is_symlink() {
return return
} }
if metadata.st_size() < cfg.min_size {
return
}
} else { return }
if path.is_file() { if path.is_file() {
if let Some(size) = std::fs::metadata(&path).ok().map(|meta| meta.len()) { let size = metadata.st_size();
if size != 0 { if size >= cfg.min_size {
registry.entry(size).or_insert(Vec::new()).push(path); registry.entry(size).or_insert(Vec::new()).push(path);
} }
}
} else if path.is_dir() { } else if path.is_dir() {
if let Ok(entries) = std::fs::read_dir(path) { if let Ok(entries) = std::fs::read_dir(path) {
for entry in entries { for entry in entries {
@ -272,6 +268,7 @@ fn register(path: PathBuf, registry: &mut HashMap<u64, Vec<PathBuf>>, cfg: &Conf
} }
} }
} }
}
} }
fn are_hardlinked(f1: &PathBuf, f2: &PathBuf) -> bool { fn are_hardlinked(f1: &PathBuf, f2: &PathBuf) -> bool {