mirror of
https://github.com/TeFiLeDo/tree-owners.git
synced 2024-11-24 05:06:18 +01:00
rethink abort conditions
This commit is contained in:
parent
5b0a00d140
commit
8736e99c3a
19
src/main.rs
19
src/main.rs
@ -38,18 +38,18 @@ fn fs_entry(entry: &Path, summary: &mut Summary) {
|
|||||||
let display = entry.display();
|
let display = entry.display();
|
||||||
if !entry.exists() && !entry.is_symlink() {
|
if !entry.exists() && !entry.is_symlink() {
|
||||||
print_root_err(format!("{display} doesn't exist"));
|
print_root_err(format!("{display} doesn't exist"));
|
||||||
}
|
|
||||||
|
|
||||||
let meta = match entry.symlink_metadata() {
|
|
||||||
Ok(meta) => meta,
|
|
||||||
Err(e) => {
|
|
||||||
print_err(e, format!("failed to get metadata for {display}"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
match entry.symlink_metadata() {
|
||||||
|
Ok(meta) => {
|
||||||
summary.add_user(meta.st_uid());
|
summary.add_user(meta.st_uid());
|
||||||
summary.add_group(meta.st_gid());
|
summary.add_group(meta.st_gid());
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
print_err(e, format!("failed to get metadata for {display}"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if entry.is_dir() {
|
if entry.is_dir() {
|
||||||
let children = match read_dir(entry) {
|
let children = match read_dir(entry) {
|
||||||
@ -63,10 +63,7 @@ fn fs_entry(entry: &Path, summary: &mut Summary) {
|
|||||||
for child in children {
|
for child in children {
|
||||||
match child {
|
match child {
|
||||||
Ok(child) => fs_entry(&child.path(), summary),
|
Ok(child) => fs_entry(&child.path(), summary),
|
||||||
Err(e) => {
|
Err(e) => print_err(e, format!("invalid child for {display}")),
|
||||||
print_err(e, format!("invalid child for {display}"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user